I am trying to do something like this one. Ordering posts by day (not time) AND meta value
I want to list blog posts ordered by date (not time) and then within that day, I want to sort them by custom field my_post_rating. This simply outputs posts ordered by rating.
$args = array( 'post_type' => 'post', 'posts_per_page' => '-1', 'meta_key' => 'my_post_rating', 'orderby' => 'meta_value_num', 'ignore_sticky_posts' => 1, ); $new_query = new WP_Query( $args );
I have also tried suggested solution but it did not worked. Please suggest what is wrong?
Edit // Var dump added
string(344) "SELECT wp_posts.* FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND (wp_postmeta.meta_key = 'my_post_rating' ) GROUP BY wp_posts.ID ORDER BY wp_postmeta.meta_value+0 DESC "