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

David Morris dvmorris at gmail.com
Thu Oct 21 00:31:43 UTC 2010


//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;
}

// and for the loop-index.php file in the theme:

<?php  while ( have_posts() ) : the_post(); ?>
...
<?php endwhile; ?>


More information about the wp-hackers mailing list