Wordpress - WP_Query orderby date not working
This will definitely work....It worked for me...
$username = get_the_author_meta( 'login', $author_id );
$args = array(
'post_type' => 'any',
'orderby' => 'date',
'order' => 'DESC',
'suppress_filters' => true,
'tax_query' => array(
array(
'taxonomy' => 'author',
'field' => 'name',
'terms' => $username
)
)
);
$query = new WP_Query( $args );
Adding
'suppress_filters' => true
into the $args
array did sorting in the order I needed.