I have to display the posts oder by last modified date. So I used the code bellow.
$args = array(
'post_type' => $post_type,
'numberposts' => '2',
'orderby' => 'modified',
'order'=> 'ASC',
);
$the_query = new WP_Query( $args );
But I could not find any update in the above code. Should i use something else instead of 'orderby' => 'modified'
in the argument.
You should use
DESC
fororder
.Try this:
Using
DESC
will give you the latest post first(descending order).EDIT:
As Andrew commented, the default value for
order
isDESC
and can thus be omitted from the code:Try