WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the the class WP_Query, using the meta_query(array). The wordpress codex says that the 'value' is a string|array. The array support is limited to a compare value of 'IN', 'NOT IN', 'BETWEEN', or 'NOT BETWEEN'.

I am having trouble as to understanding the 'IN', 'NOT IN', or 'BETWEEN' arguments.

Could someone please help me as to understanding this or better yet a working example i could go by. I'm trying to query posts on a single page template by meta_key without writing a seperate template for each meta_value. After some research the query_posts that I've been using is just not the way to go.

Any help would be much appreciated. Thanks!

share|improve this question
For the future: Please use proper Upper-/lowercase and the WYSIWG editor buttons. Thanks. – kaiser Oct 13 '12 at 15:03

As I understand it, IN, NOT IN, or BETWEEN work essentially like the MySQL operators of the same name. They are just abstracted somewhat.

However, it sounds to me like you don't need to worry about that. Your description makes me think that you are only worried about the meta_key itself and not any particular meta_values or range of values, which means you can just use a simple meta_key argument (Look for "Simple Custom Field Query:")

share|improve this answer

Your Answer


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.