Return to Snippet

Revision: 55932
at March 1, 2012 00:09 by crypticsoft


Initial Code
$args = array('post_type'=>'bbfitness_exercises',
			'tax_query' => array(
					array(
						'taxonomy' => 'bbfitness_exercises_types',
						'field' => 'id',
						'terms' => $etype
					)
				)
		);				

		// The Query
		$the_query = new WP_Query( $args );
		$result = $the_query->posts;

Initial URL

                                

Initial Description
When you create a custom post type and need to query by ID then you can pass in the 'field' and the 'terms' with the ID for that post type.

Initial Title
WordPress Query Taxonomy by ID

Initial Tags
post, wordpress

Initial Language
PHP