Multiple nested meta queries
Multiple nested meta queries
Multiple nested meta queries
You are correct, this is not possible for serialised data. There are some hacks to try and get around this by searching for individual parts of the serialised string, but those throw up lots of false positives and can’t be sorted. Generally, it’s an anti-pattern to store structured data inside a single meta value, and … Read more
Thats because you created the meta_query property incorrectly, it should be a multi diminsional array. $pet_owners = new WP_Query([ ‘post_type’ => ‘pet_owner’, ‘posts_per_page’ => -1, ‘meta_query’ => [ [ ‘key’ => ‘pet’, ‘value’ => ‘cat’, ‘compare’ => ‘!=’ ] ] ]); For more information about meta_query see Custom Field (post meta) Parameters
Combine query in WP_User_Query()
I want to echo a list of all users who have that field; in other words, a list of each user’s name, phone number, and the quantity. Try this, which is based on your 1st snippet: ( and this is all you need; no need for the $wpdb->get_col() snippet ) $user_query = new WP_User_Query( array( … Read more
This isn’t possible using WP_Query, you can’t query the insides of structured data stored in a single post meta value. At best you can use regular expressions, or do math/boolean comparisons, you can even do LIKE comparisons, but these are all string operations. If you need to query structured data such as objects or arrays, … Read more
Query on meta values and post title
Filter images from media library by guid meta field
multiple meta_query and orderby question
I finally managed to solve it myself, this is the code I used: if($tema == ” && $software == ” && $volatilita == ”) { $args=array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘orderby’ => ‘meta_value meta_value_num’, ‘order’ => ‘DESC’, ‘paged’ => $paged, ‘cat’ => $categoria_slot_machine, ); } elseif($tema != ” || $software … Read more