[wp-hackers] Pagination problem after updating to version 3.2.1
Bill Erickson
bill.erickson at gmail.com
Wed Jul 27 14:34:31 UTC 2011
Could it be that your default $wp_query is using 10 posts per page (set in
Settings > Reading), but your custom query is using 5? When you load the 3rd
page WordPress goes to the database and looks for posts 21-30 and if there's
any found it will then load your template, which is querying 5 posts (so on
page 3 it's looking for 11-15). If you have less than 21 posts, it will
return a 404 before getting to your query.
Ways around this:
- Set the default posts_per_page to 5 in Settings > Reading
- Use hook pre_get_posts to set the default query to 5 posts per page in
certain instances (ex: if (is_category()) )
---
Bill Erickson
WordPress Consultant
http://www.billerickson.net
On Wed, Jul 27, 2011 at 9:30 AM, Leo Baiano <ljunior2005 at gmail.com> wrote:
> Drikinha of my heart, you are using array_merge to preserve the query
> pattern and add some parameters, right? Have you tried using $query_string,
> as shown in the codex, rather than merge? Type:
>
> global $ query_string;
> query_posts ($ query_string. "posts_per_page & = 5 & page = '. $ paged);
>
> Reference: #
> http://codex.wordpress.org/Function_Reference/query_postsUsage_Note
>
> You could paste the code portion where the plugin is called? Sometimes the
> position of wp_reset_query () called for plugin influence on the paging and
> last.
>
> 2011/7/26 wpmidia lab <wpmidia at gmail.com>
>
> > Does anyone know if after upgrading to WordPress version 3.2.1 pagination
> > has stopped working properly?
> >
> > I am facing this problem at the moment. I've tried everything already
> > searched the internet and found a link where a person claiming the same
> > problem.
> >
> > The problem occurs in file category.php. Apparently the layout is
> perfect,
> > but when accessing the page 3, I get a 404 page.
> >
> > *A piece of Code:*
> >
> > <?php
> > get_header();
> >
> > global $wp_query;
> >
> > $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
> > query_posts(
> > array_merge( array('posts_per_page' => 5, 'paged' => $paged),
> > $wp_query->query
> > )
> > );
> > ?>
> >
> > I'm using WP Pagenavi plugin for paging ....
> >
> > Could someone help me?
> >
> > Thanks in advance!
> >
> > --
> > *Míriam de Paula *
> > *(aka Drika)*
> >
> > wp*midia*
> > *desenvolvimento web*
> > http://wpmidia.com.br
> > twitter: @wpmidia
> > facebook: http://www.facebook.com/paginadamiriamdepaula
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
>
>
>
> --
> Amplexos,
>
> Leo Baiano
> http://www.leobaiano.com
> http://www.blog.ljunior.com
> http://www.mcelebridades.com
> http://www.twitter.com/leobaiano
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list