0

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?

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.