• So I run a query with multiple post types and then I run the same query with just one post type. They don’t give the results in the same order. IE, given they are the same post_type, one displays them as a b c d while the other b a d c. Why and how do I get them to display in the same order?

    $query = new WP_Query( array(
            'post_type'         => array('column','interview','question','photo','post'),
            'posts_per_page'    => 10,
            'post_status'       => 'publish',
            'order'		    => 'ASC',
            'orderby'	    => 'date'));
    foreach($query->posts as $dump){
    	var_dump($dump->post_title);
    	var_dump($dump->post_type);
    }
    wp_reset_postdata();
    
    echo '<h1>BREAK</h1>';
    
    $query = new WP_Query( array(
            'post_type'         => array('column'),
            'posts_per_page'    => 10,
            'post_status'       => 'publish',
    	'order'		    => 'ASC',
    	'orderby'	    => 'date'));
    foreach($query->posts as $dump){
    	var_dump($dump->post_title);
    	var_dump($dump->post_type);
    }

    The order and orderby don’t solve the problem.

    Yes I disabled all pluggins and it made no difference.

  • The topic ‘WP_Query different order when given different post_type’ is closed to new replies.