I was wondering whether I could filter to show only posts with a custom field of, for instance, “next” (as the key, the value doesn’t really matter at the moment.)
<?php $my_query = new WP_Query('meta_key=next'); while ($my_query->have_posts()) : $my_query->the_post(); ?> do stuff <?php endwhile; ?></div>
Can somebody explain why this doesn’t work and how, perhaps, I can achieve what I’m trying to do?
I guess it’s the argument I’m putting in ‘meta_key=next’ as ‘page_id=8’, for instance, works fine.
- The topic ‘post_meta in WP_Query’ is closed to new replies.