Question

I've created a custom post, events, and saved the meta data event_year to each event. I'm trying to get a year's event archive. When I go the the following URL, the meta_key and meta_value are not set for some reason, and thus the event archive is unfiltered.

/?post_type=events&meta_key=event_year&meta_value=2011

Debugging the values:

echo $wp_query->query_vars['post_type']; // 'events'
echo $wp_query->query_vars['meta_key']; // -blank-
echo $wp_query->query_vars['meta_value']; // -blank-

Why can't I set the meta_key and meta_value?

The meta_values are saved to the events. I've successfully displayed them:

get_post_meta($post->ID, 'event_year', true); // '2011'  

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top