0

Possible Duplicate:
Orderby = none not working

I want to use $query = new WP_Query( 'post__in' => array( 2, 5, 12, 14, 20 ) ) ); to retrieve posts by ID, I do and the result ordered by publish date but I want to retrieve in same of IDs in this example in this order: 2, 5, 12, 14, 20

1

In WordPress 3.5, you'll be able to do this with the 'orderby' parameter set to 'post__in'.

Until then, this question is basically identical to another one, which I wrote an answer for already: Orderby = none not working

0

In your example you can order by ID ascending to get those results:

$query = new WP_Query( 
    array(
        'post__in' => array( 2, 5, 12, 14, 20 ),
        'orderby' => 'ID',
        'order' => 'ASC'
    )
);

see WP_Query in Codex for the full list of arguments.

  • this is not solution but in this case ignore 2, 5, 12, 14, 20 – Ehsan Oct 1 '12 at 15:09
  • then edit your question to be more specific about what you're trying to achieve. – Milo Oct 1 '12 at 15:10
  • I said that I want ordering by 2, 5, 12, 14, 20 ... excuse me for my bad english – Ehsan Oct 1 '12 at 15:14

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