Support » Fixing WordPress » Query_posts using multiple custom values (meta_value)
8 years, 1 month ago
I’ve been trying to generate a query_post call to get a list of posts that have 2 or more meta_values, but it’s been impossible.
Basically, let’s say that all posts have a custom field called “age”.. and I want to get (using query_posts function) all posts which have age=22 and age=25.
but, obviously, I’ve got no success… Anyone knows how to solve this?
Can’t do that with the template tag, query_posts(), custom field paramters.
You’d have to get all posts with a meta_key=age then filter (if test) in your Loop.
Our build a custom query that did that but that’s more complicated. Ref: Displaying_Posts_Using_a_Custom_Select_Query
8 years ago
Gracias! It’s easier, faster and simplier to adjust my blog to query_post() schema instead of diving into mySQL.