Query multiple meta key values?

I feel like there’s an AND/OR confusion going on here. The queries in the OP will only return posts which have both key1 = ‘value1’ AND key2 = ‘value2’. Most WP plugins (that I know of, anyway) do not store multiple values in postmeta, for the same post, using the same key. If what you … Read more

How can I create a meta_query with an array as meta_field?

Feeding the query an array of possible values If the value in the database is a string and you want to feed the query several values: $args = array( ‘post_type’ => ‘news’, ‘meta_query’ => array( array( ‘key’ => ‘topics’, ‘value’ => array ( ‘sports’, ‘nonprofit’, ‘community’ ), ‘compare’ => ‘IN’ ) ) ); Searching for … Read more

How to display SQL query that ran in query?

Hi @Keith Donegan: If I understand your question correctly I think this is what you are looking for? <?php echo $GLOBALS[‘wp_query’]->request; ?> $wp_query is a global variable that contains the current query run by the loop. If you run the above code anytime while the loop is still active or even right after the loop … Read more