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.

how can i use multiple meta_key and meta_value in query_posts?

For example, I want to find multiple content with two different meta_key and meta_value. How do I do this?

i using this code but not effective:

query_posts('meta_key=test2&meta_value=hello&meta_key=test2&meta_value=bye');

please help me...

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

This is not currently possible with query arguments alone (realm of filtering raw SQL query and such).

If your task is not time-critical then I suggest to wait for upcoming WP 3.1 release. It will feature much more flexible querying capabilities for custom fields.

See Advanced Metadata Queries for post on upcoming improvements.

share|improve this answer
    
thanks .i wait for wp 3.1 –  mehdi Dec 24 '10 at 20:35
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.