I want to order a list of post on basis of ratings. I have used meta key "wp_ratings" for storing the rating value in wp_postmeta table. Now I want to sort all posts . If a post does not contains the meta key , then sort it with date.
$args = array( 'post_type' => 'recipe', 'post_status' => 'publish', 'posts_per_page' => 40, 'orderby' => array( 'meta_value_num' => 'DESC', 'date' => 'DESC' ), 'meta_key' => 'wp_ratings', ); $my_query = new WP_Query( $args ); echo '<pre>'; var_dump( $my_query ); echo '</pre>';
It is still showing me only 4 post that has wp_ratings postmeta . But it is not showing me the rest 36 posts.
FYI: I am using WP 4.0.1 I am using this code, but still its not working.