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.

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
add comment

1 Answer

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
add comment

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.