I'm having custom field "prime" with values yes or no. I want to get the post id's with selected value "Yes".How can i get that.
Thanks in advance
Try something like this
code isn't tested but it should work. If you don't wont post ids into array just replace whole
Set 'numberposts' argument to -1, so it will return all posts not only 5 as default. Thanks to @Brady
Personally I would use a custom SQL query to do this as then I'm returning just the ID's that I need. But to do it the WP way you can use this:
$posts will hold an array of objects. These objects hold all the post data you would need for a loop etc