Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#18345 closed defect (bug) (invalid)

Problem with query_posts

Reported by: toniboni88's profile toniboni88 Owned by: toniboni88's profile toniboni88
Milestone: Priority: normal
Severity: normal Version: 3.2.1
Component: Query Keywords:
Focuses: Cc:

Description

When I use the function "query_posts" --> http://codex.wordpress.org/Function_Reference/query_posts" before the loop, I see correctly the first posts, but if I click on other pages http://i51.tinypic.com/29mt0tc.jpg I look the same articles, even if I go on the last page.

Example:

query_posts( 'cat=1' );

Change History (2)

#1 @kaspy2011
13 years ago

I have the same problem.

#2 @SergeyBiryukov
13 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

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' );
Last edited 13 years ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.