Check any post within custom post types that has "taxonomy A"
-
Hi every one.
So I got one taxonomy called “Meal type”. And I have several post types like “fish”,”chicken”,”meat”. The “Meal Type” taxonomy is shared between all these post types
I want to check each of these post types and display the post that has “Cooked” as the Meal Type in order.
Up till now, I was using this code below for each post type one after another.
<?php
$loop = new WP_Query( array( ‘post_type’ => ‘fish’) );
while ( $loop->have_posts() ) : $loop->the_post();
if(has_term( ‘cooked’, ‘meal_type’, $post->ID )) : ?>
//menu link
<?php endif; ?><? endwhile; ?>IS there a shorter /proper way to aproach this problem.
Thank you
- The topic ‘Check any post within custom post types that has "taxonomy A"’ is closed to new replies.