post_meta in WP_Query
-
Hi
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.)
I’ve tried
<?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.
Thank you.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘post_meta in WP_Query’ is closed to new replies.