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>”;

Filter loop by ‘price’ with meta_query

Ok, found the problem. I had to add ‘type’ => ‘numeric’, to my query. So the final code looks like: $adsAll = array( ‘post_type’ => $postType, ‘meta_key’ => $metaKey, ‘orderby’ => $orderBy, ‘order’ => $order, ‘posts_per_page’ => $PostsPerPage, ‘meta_query’ => array( array( ‘key’ => ‘preco_anuncio’, ‘value’ => array(‘8700′,’500000’), ‘compare’ => ‘between’, ‘type’ => ‘numeric’, ), … Read more

Meta_Query refuses to return results

You forgot the meta_query key in your $args. $meta_query = array( ‘relation’ => ‘OR’, array( ‘key’ => ‘tic_assignment’, ‘value’ => $current_user -> ID, ‘compare’ => ‘=’, ), array( ‘key’ => ‘tic_department’, ‘value’ => $_depts, ‘compare’ => ‘LIKE’, ), ); $_args = array ( ‘post_type’ => ‘tickets’, ‘meta_query’ => $meta_query, ‘posts_per_page’ => 10, ‘orderby’ => ‘date’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)