Support

Account

Home Forums Front-end Issues Strange results when using orderby a number field Reply To: Strange results when using orderby a number field

  • Just want to make sure that this is exactly what your code looks like:

    
    <?php
    mypost = array(
    ‘post_type’ => ‘listing’,
    ‘posts_per_page’ => 20,
    ‘meta_key’ => ‘revenue_number’,
    ‘orderby’ => ‘meta_value_num’,
    ‘order’ => ‘DESC’
    ); $loop = new WP_Query( $mypost ); ?>
    

    If it is then you’re missing a $ in front of mypost on the first line.