Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

SELECT SQL_CALC_FOUND_ROWS wp_posts.ID 
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?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.