Fetch all data of Users
Actually since you already have the ID you could just loop through and get the meta. https://developer.wordpress.org/reference/functions/get_user_meta/ get_user_meta(ID)
Actually since you already have the ID you could just loop through and get the meta. https://developer.wordpress.org/reference/functions/get_user_meta/ get_user_meta(ID)
You’ve provided the answer to your own question, query for meta key _thumbnail_id to get posts with a featured image: $args = array( ‘meta_key’ => ‘_thumbnail_id’, ‘posts_per_page’ => 3 ); $latest_with_thumbnails = new WP_Query( $args );
$wpdb->wp_postmeta is wrong. Always use just $wpdb->postmeta – without further prefixes. So… global $wpdb; $querystr = ” SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key LIKE ‘movie_name’ ORDER BY meta_value ASC “; $movie_names = $wpdb->get_results( $querystr, OBJECT ); if ( ! $movie_names ) { $wpdb->print_error(); // Get the last error message for debugging } else { … Read more
Use a meta_query and set type to NUMERIC– $query->set(‘meta_query’, array( array( ‘key’ => ‘_ai_price_int’, ‘value’ => array(0, 4000), ‘compare’ => ‘BETWEEN’, ‘type’ => ‘NUMERIC’ ) )); $query->set(‘meta_key’, ‘_ai_price_int’); $query->set(‘orderby’, ‘meta_value_num’);
As documented, you can set the compare property of the meta query to NOT EXISTS: $args[‘meta_query’] = array( array( ‘key’ => ‘instrument’, ‘compare’ => ‘NOT EXISTS’, ), );
pre_get_posts triggers for every query (front and admin side). It also triggers when querying nav-menu items (which is what is happening here). Most of the time you only want to filter particular queries – so you need to check if that query is one you wish to modify. Usually – and I think your example … Read more
Finally, this meta_query works : ‘meta_query’ => array( ‘relation’ => ‘OR’, array( ‘key’ => ‘votes_average’, ‘value’ => ‘6’, ‘compare’ => ‘<‘, ‘type’ => ‘NUMERIC’, ), array( ‘key’ => ‘votes_average’, ‘compare’ => ‘NOT EXISTS’, ‘value’ => ‘null’, ) ),
You could try this instead: $bc_args = array( ‘post_type’ => ‘data’, ‘data-category’ =>’insurance-rate’, ‘order’ => ‘DESC’, ‘orderby’ => ‘meta_value_num’, ‘meta_query’ => array( array( ‘key’ => ‘interest_rate’, ‘value’ => (int) $i_rate, ‘type’ => ‘numeric’, ‘compare’ => ‘>=’ ), ) ); $sortedPosts = new WP_Query( $bc_args ); where we use the numeric type. You should also consider … Read more
I think you have used wrong comparison operators in meta query .It should be >= for ‘event_start_date’ and <= for ‘event_end_date’ .
Remove the quotes around the values for your second meta query. You’re comparing numbers to chars, which won’t work.