Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need to request a certain list of posts in the order I want. I'm getting the posts using:

query_posts('category_name'=>'cases', 'posts_per_page'=>5, 'post__in'=>$_SESSION['sorting'], 'paged'=>$paged);

It works in that I get the posts in the array $_SESSION['sorting'] but the problem is that my sorting gets lost even if iI don't suggest a special orderby field.

Can anyone help me?

share|improve this question

migrated from stackoverflow.com Jul 6 '11 at 12:59

This question came from our site for professional and enthusiast programmers.

1 Answer 1

post__in doesn't affect the ordering at all.

You can achieve the order you want by hooking into the 'posts_orderby' filter and use MySQL's FIND_IN_SET() function.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.