To add a filter based on metadata to a post we use the following format:
$wp_query->query_vars['meta_key'] = 'meta_key_name'; $wp_query->query_vars['meta_value'] = meta_value;
How can I add more than one metadata field?
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
Those are the old style meta query arguments. You should use
meta_query instead, which will allow querying on multiple meta keys with conditions and nesting. See the Custom Field Parameters section in
WP_Query for examples.