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 cannot order my query by meta value by numbers, and ordering by post order does not work too. This is my code:

$args = array(
      'posts_per_page' => '-1',
        'post_type' => 'post',
        'order'     => 'ASC',
        'meta_key' => 'nda_cf3',
        'orderby'   => 'meta_value_num', //or 'meta_value_num'


    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    echo '<li rel="'.get_post_meta($post->ID, 'nda_cf3', true).'"><strong><a href="'.get_permalink().'">'.get_the_title().'</a></strong>'.' <p>'.get_the_content().'</p></li>';

share|improve this question
Do you use any plugin(s) which modify query or post order? – Max Yudin Sep 13 '13 at 10:16
Is nda_cf3 actually a number? Letters or punctuation will cause strange results. I don't know what you mean by "post order"-- "post ID" maybe? – s_ha_dum Sep 13 '13 at 13:25

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.