Support

Account

Home Forums Front-end Issues Sorting by date Reply To: Sorting by date

  • Ah!

    Also, check that you don’t have any ‘pre_get_post’ filters that are modifying the args

    That put me int he right direction. none of the other orderby arguments seem to work.

    I changed up the query to:

    $args = array(
    	'post_type' => 'portfolio',
    	'posts_per_page' => '-1',
    	'meta_key' => 'date_received',
    	'orderby' => 'meta_value_num',
    	'order' => 'DESC'
    		
    );
    remove_all_filters('posts_orderby');
    $query = new WP_query($args);

    And that fixed it. If this was in the documentation, my apologies for not seeing it. Either way, I’m good to go and thank you for your help.