WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

Your Answer


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

Browse other questions tagged or ask your own question.