I've exhausted myself with this and I couldn't figure out why when I do this

$myposts = new WP_Query( array('numberposts' => 5,
'offset' => '0',
'post_type' => 'noticias',
'orderby' => 'meta_value_num',
'order' => 'DESC',
'post_status' => 'publish',
'meta_key' => '_countview'

wordpress queries the db with the following SQL:

FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id) 
WHERE 1=1 
 AND wp_posts.post_type = 'noticias' 
 AND (wp_posts.post_status = 'publish') 
 AND (wp_postmeta.meta_key = '_countview' ) 
GROUP BY wp_posts.ID ORDER BY wp_posts.post_date ASC LIMIT 0, 5

did something change for 3.4 and i'm missing the syntax?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.