Broken pagination, need help figuring out why!

First, if you want to load posts outside of the default query for the page, use WP_Query. Calling query_posts should be done only to modify parameters of the default query.

The pagination issue stems from calling query_posts, you’re overwriting the page parameter (and all other parameters) by calling it in your template. If you want to retain the original parameters and modify them:

global $query_string; // get the global query_string for this query
query_posts( $query_string . '&cat=-13' ); // add to the query string whatever we want to change from the defaults

EDIT- oops, too slow. I would still change your featured query to use WP_Query instead. Once you’re in the template, your default query for the page has already run. When you call query_posts you’re throwing out that query and making a new one, which is inefficient and should be avoided if possible.

Leave a Comment