get_post_meta Inside A Taxonomy Query?
Kind of weird to explain, but I am tagging basic WP posts by photographer (taxonomy).
Then I have custom post type pages that serve as profile pages for these photographers and I want to query all the posts they have been tagged in on these pages.
I thought it would be simple at first, that I could just enter the individuals name/taxonomy in a custom field and then use that custom field in the posts query like…
<?php $loop = new WP_Query( array('photographer' => ' echo get_post_meta($post->ID, 'PhotographerTax', TRUE); ', 'orderby' => 'title', 'order' => 'asc', 'posts_per_page' => 100 ) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php the_title(); ?> <?php the_excerpt(); ?> <?php endwhile; ?>
But something about trying to get_post_meta inside of a query jacks it all up. Any suggestions?
- The topic ‘get_post_meta Inside A Taxonomy Query?’ is closed to new replies.