WordPress query_posts order DESC not working

In this snippet the order=DESC and orderby=date clauses seems to be ignored.
I checked the code and the part '&orderby=date&order=DESC' seems correct.
var_dump still return posts in wrong order.
Tried to order by ID, post_title, title, date and modified, the order returned simply does not change at all… These parameters are ignored.

$latest_posts = query_posts('post_type=' . $post_type . '&cat=' . $category . '&terms=' . $terms . '&posts_per_page=' . $number . '&orderby=date&order=DESC');
var_dump($latest_posts);

Related posts

Leave a Reply

1 comment

  1. Specify the column name for sorted order. Now you are entering wrong.
    So use post_date instead of date

    $latest_posts = query_posts('post_type=' . $post_type . '&cat=' . $category . '&terms=' . $terms . '&posts_per_page=' . $number . '&orderby=post_date&order=DESC');
    var_dump($latest_posts);