Revision: 53648
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 30, 2011 18:33 by f6design
Initial Code
<?php // Example query to select all posts belonging to a custom taxonomy. $args = array( 'tax_query' => array( array( 'taxonomy' => 'TAXONOMY_NAME', 'field' => 'slug', 'terms' => 'TAXONOMY_SLUG' ) ) ); $the_query = new WP_Query( $args ); // The Loop while ( $the_query->have_posts() ) : $the_query->the_post(); echo '<li>'; the_title(); echo '</li>'; endwhile; // Reset Post Data wp_reset_postdata(); ?>
Initial URL
Initial Description
Use WP_Query to query a custom taxonomy, using the tax_query parameter.
Initial Title
Wordpress: Query a custom taxonomy
Initial Tags
wordpress
Initial Language
PHP