[wp-hackers] Filtering a loop by a custom taxonomy term assignment

scribu mail at scribu.net
Thu Oct 21 00:46:23 UTC 2010


On Thu, Oct 21, 2010 at 3:31 AM, David Morris <dvmorris at gmail.com> wrote:

> //in functions.php
>
> add_action( 'pre_get_posts', 'test_pre_get_posts' );
> function test_pre_get_posts( $query ) {
> $query->set('taxonomy','test');
>  $query->set('term','test_term');
>  return $query;
> }
>

Try this instead:

function test_pre_get_posts( $query ) {
  $query->set('test', 'test_term');
}


More information about the wp-hackers mailing list