query_posts and meta_value=
I’m trying to use query_posts in a multiple loops situation, and I could use some help. I want to query all the posts that have any-value in the Custom Field with Key=”Map”. I want to display a list of the maps (a list of the custom field values, they are actually hyperlinks to maps) along with other info from the posts like the post title.
Title Of My Post
Here is my Map: MY CUSTOM FIELD VALUE HERE
So I’m reading:
I learned that in WP 2.6+, you can use Custom field Parameters on query_posts like this:
Custom field Parameters
Retrieve posts based on a custom field set in the post
Both the meta_key and meta_value need to be set.
My question is, why does the Codex say that BOTH
meta_valueneed to be set? I only want to set
meta_key=Map. I don’t know what the
meta_valuewill be. I want to get the meta_value from the posts that have
meta_key=Map. What is the method to say
By the way, I realize I can do this with a plugin (sort of), like Custom Field Values plugin. I’m trying to learn to do it with
query_postsbecause it would give me more options and flexibility in the way I display it alongside other post data.
I tried it with just meta_key and without using meta_value, and I think it actually worked, I’m just not sure why the Codex says that.
Thanks in advance for advice on this!
See revised article for better explaination:
- The topic ‘query_posts and meta_value=’ is closed to new replies.