Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is there a way to find the ids of the pages who contain meta tags/custom fields with a certain key-value pair?

Say, for instance, that I wanted to find all of the pages who had a meta-tag/custom-field key of "weather" with a value of "raining", is there a way to do that?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Why not? Same custom field parameters in query should apply and you can use post_type argument to limit query to pages alone.

share|improve this answer
    
I wasn't saying the solution could not also apply to posts, I was simply stating that the solution must apply to pages –  cmcculloh Jun 27 '11 at 18:56
    
@cmcculloh sorry, I got tone of your question as is this is something unlikely, but it seems rather simple. Unless I am missing something? Does my answer fits what you need? –  Rarst Jun 27 '11 at 18:59
    
ah, see, I'm a big newb, so I have no idea what is likely and what is unlikely. I'll edit my question a little. Thanks for the feedback! I'm not sure if your answer fits what I need or not, I'm still looking in to it... –  cmcculloh Jun 27 '11 at 19:21
    
Yes, this works, thank you! –  cmcculloh Jul 9 '11 at 17:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.