WordPress.org

Support

Support » Themes and Templates » [Resolved] WP_Query order posts/pages by ID sequence

[Resolved] WP_Query order posts/pages by ID sequence

  • silverks

    @silverks

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] WP_Query order posts/pages by ID sequence’ is closed to new replies.