To display the post order by modified date in wordpress

You should use DESC for order.

Try this:

 $the_query = new WP_Query( array(
     'post_type'   => $post_type,
     'numberposts' => '2',
     'orderby'     => 'modified',
     'order'       => 'DESC',
 ));

Using DESC will give you the latest post first(descending order).

EDIT:

As Andrew commented, the default value for order is DESC and can thus be omitted from the code:

 $the_query = new WP_Query( array(
     'post_type'   => $post_type,
     'numberposts' => '2',
     'orderby'     => 'modified',
 ));

Tags:

Wordpress

Post