WordPress Query Taxonomy by ID
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.
Copy this code and paste it in your HTML
$args = array('post_type'=>'bbfitness_exercises', 'taxonomy' => 'bbfitness_exercises_types',
'field' => 'id',
'terms' => $etype
)
)
);
// The Query
$the_query = new WP_Query( $args );
$result = $the_query->posts;
Report this snippet
Comments
Subscribe to comments