Order posts by ID in the given order

Starting in WordPress 3.5, the orderby parameter will allow the value post__in to sort by the order of the post__in parameter, just like in your example.

It may not be ideal to wait or require 3.5+, but this will almost certainly be the best and easiest way to do what you’re looking to do.

Here’s the relevant trac ticket if you want the details.

Leave a Comment