WP_Query('orderby=post_date') not working with wordpress

WP_Query('orderby=date&order=DESC') 

The following 3 parameters will give you the posts in Ascending order from the date it was published (i.e The older posts will be shown first)

'post_status' => 'publish', 'orderby' => 'publish_date', 'order' => 'ASC'

When you change the order to DESC you will get the posts in Descending order from the date it was published (i.e The latest posts will be shown first)

'post_status' => 'publish', 'orderby' => 'publish_date', 'order' => 'DESC'

<?php
$postsPerPage = 10;
$page = 1;
?>
<?php
$query = new WP_Query(array(
    'cat' => 4,
    'post_status' => 'publish',
    'orderby' => 'publish_date',
    'order' => 'ASC',
    'paged' => $page,
    'posts_per_page' => $postsPerPage));
?>

To order by the modification date you have use orderby=modified.

WP_Query( 'orderby=modified&order=DESC' ) 

See the documentation for more possible values.

Tags:

Php

Wordpress