Get Posts from Custom Meta Query

Add ‘relation’ => ‘OR’ to your Meta Query, I think it will be something like this… ‘meta_query’ => array( ‘relation’ => ‘AND’, // Optional, defaults to “AND” array( ‘key’ => $country_meta_key, ‘value’ => $country, ‘compare’ => ‘LIKE’ ), array( ‘relation’ => ‘OR’, array( ‘key’ => $state_meta_key, ‘value’ => $us_state, ‘compare’ => ‘LIKE’ ), array( ‘key’ … Read more

Query for user roles and their skills

There is one small issue. You have to user ‘IN’ instead of = because you want to check values with array $args = array( ‘role’ => ‘candidate’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘as_skills’, ‘value’ => array(‘skilla’,’skillx’,’skille’), ‘compare’ => ‘IN’ ), ), ); $test = get_users($args); echo “<pre>”; print_r($test); echo “</pre>”;

Meta Query returning empty array

As /u/Nicolai suggested in the question comment section, it’s always a good idea to add in post_status not only for validity but for speed purposes too. It could look like this: $practice_args = array( ‘post_type’ => ‘sf-location’, ‘post_status’ => ‘publish’, ‘meta_query’ => array( array( ‘key’ => ‘practice_id’, ‘value’ => $current_practice_id, ), ), );