I have been searching for an answer and it seems like there are a lot of answers for the opposite issue. I am trying to sort by publish date, not by date modified, using this code:
query_posts($query_string . '&orderby=date&order=DESC&posts_per_page=-1');
But it is still sorting on date modified not publish date, can anyone help?
Thanks in advance!
You should not have to specify
orderby=date
. That is the default. If you look at the query, you will see that the field used ispost_date
, which is the publication date and not the modification date–post_modified
.You can prove this just by dumping
$wp_query
after your call toquery_posts
. Or try:With no other parameters you get
ORDER BY wp_posts.post_date DESC
.If you are not getting that order there is already a filter that is altering default behavior. What is adding that filter I can’t guess.
And yes, please don’t use
query_posts
.