[wp-trac] [WordPress Trac] #15962: Category 'posts_per_page' being ignored in query_posts when 'Blog pages show at most' set to 10

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 23 10:50:48 UTC 2010


#15962: Category 'posts_per_page' being ignored in query_posts when 'Blog pages
show at most' set to 10
--------------------------+-----------------------------
 Reporter:  tawilson      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  3.0.3
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 The scenario for this is as follows:

 * Using default category base.
 * In 'Appearance -> Reading', 'Blog pages show at most' is set to 10.
 * The permalink is accessing the category using it's slug name.
 * The category is using a custom 'category-slug.php'.

 In the custom category, I have the following code, above the call to
 'get_header()'.

 {{{
 global $wp_query;

 query_posts(
                 array_merge(
                         $wp_query->query,
                         array(
                                 'posts_per_page' => 2,
                                 'posts_per_archive_page' => 2
                                 )
                         )
 );

 }}}

 The first page shows 2 posts when the permalink is '/category/slug/'.

 However, when the permalink is '/category/slug/page/2/', the query with
 the 'posts_per_page' set to 10, and as I only have 4 posts, it shows
 nothing.

 If I set 'Blog shows at most' to something other than 10, it obeys my
 overridden value.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15962>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list