0

I can't get my posts to order by the date, descading. I've got the following code:

$jobs = new WP_Query(array(
    'posts_per_page' => 50,
    'post_type' => 'job',
    'post_status' => 'publish',
    'orderby' => 'post_date',
    'order' => 'DESC',
    'cache_results' => false
));

And this is the output of $jobs->request:

SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'job' AND ((wp_posts.post_status = 'publish')) AND post_date >= "2014-09-10"   LIMIT 0, 50

Somehow the whole ordering section is missing, and there's 3 spaces instead. What happened?

1 Answer 1

0

Your orderby parameter value should be date and not post_date. Have a look at the orderby and order parameters in WP_Query

I know the was a track ticket out about this subject, just can't remember where, but yes, I do agree that the value should be post_date and not date

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.