$args = array('post_type' => 'etlap', 'posts_per_page' => 5, 'post__in' => $ids, 'post_status' => 'any', 'orderby' => 'post__in');

I want to make the orderby status reversed. How is it possible?

Sorry if I ask stupid question, but I couldn't find any documentary about that.


Since you are using 'post__in' in the 'orderby' parameter, the 'order' parameter will have no effect, however, you can simply reverse the array you are passing to 'post__in':

$args = array(
                'post_type' => 'etlap',
                'posts_per_page' => 5,
                'post__in' => array_reverse($ids),
                'post_status' => 'any',
                'orderby' => 'post__in'
  • array_reverse doesn't seems working for me :(
    – DeluxeD
    Dec 25 '17 at 23:24
  • Sorry, it worked, just my posts had bad relase dates.
    – DeluxeD
    Dec 25 '17 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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