[wp-trac] [WordPress Trac] #18345: Problem with query_posts

WordPress Trac wp-trac at lists.automattic.com
Sat Aug 6 20:25:00 UTC 2011


#18345: Problem with query_posts
--------------------------+-------------------------
 Reporter:  toniboni88    |       Owner:  toniboni88
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Query         |     Version:  3.2.1
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |
--------------------------+-------------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-patch =>
 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 [http://codex.wordpress.org/Function_Reference/query_posts#Usage_Note]:

  The `wp_query` object will generate a new SQL query using your
 parameters. When you do this, WordPress ignores the other parameters it
 receives via the URL (such as page number or category). If you want to
 preserve that information, you can use the `$query_string` global variable
 in the call to `query_posts()`.

 Try this:
 {{{
 global $query_string;
 query_posts( $query_string . 'cat=1' );
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18345#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list