The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] WP_Query order posts/pages by ID sequence (3 posts)

  1. silverks
    Posted 4 years ago #

    Hello everyone,

    I am basically using WP_Query and the post__in parameter to get specific posts and pages in my theme. The problem is, I can't seem to get the posts returned in the order of the IDs passed to the post__in parameter.

    For example, when I enter the IDs as 1,65,10,55, where those IDs consist of both posts and pages, I want the returned posts and pages to be ordered exactly in the order of those IDs, i.e. post with ID 1 first, followed by post/page with ID 65, and so on.

    I have tried using 'orderby' => 'none', but to no avail as well.

    Note that I have defined 'post_type' => array( 'post', 'page' ) so that both posts and pages are returned.

    Thanks for any help.

  2. keesiemeijer
    Posted 4 years ago #

  3. silverks
    Posted 4 years ago #

    Thanks! Just what I need :)

Topic Closed

This topic has been closed to new replies.

About this Topic