How To Order WP Query By Multiple Columns

Looking to use orderby to order multiple WP Query columns? All you may need is to feed the orderby argument an array with different columns.

Order by multiple columns in WP Query

To order by multiple columns in WP Query, you must use an array inside your loop’s orderby argument.

$args = array(
     post_type => 'post',
     orderby => array(
          'date' => 'ASC',
          'titlle' => 'DESC'
     )
);
$loop = new WP_Query( $args );
while ( $loop->have_rows() ) : $loop->the_row();
     //the loop's content
endwhile;