using multiple meta_key and meta_value in query_posts
-
16-10-2019 - |
Question
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...
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange