[wp-trac] [WordPress Trac] #11067: Using query_posts() on any subcategories the attached posts_per_page attribute gets lost

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 2 23:30:06 UTC 2009


#11067: Using query_posts() on any subcategories the attached posts_per_page
attribute gets lost
--------------------------+-------------------------------------------------
 Reporter:  voetzi        |       Owner:       
     Type:  defect (bug)  |      Status:  new  
 Priority:  normal        |   Milestone:       
Component:  General       |     Version:  2.8.5
 Severity:  normal        |    Keywords:       
--------------------------+-------------------------------------------------
 I have a subcategory containing 9 posts. If this category is showed with
 the archive.php temlate, i want it to show only one post per page. The
 default posts per page value in the WP settings is 5. So i build a query
 this way:

 {{{
 query_posts( $query_string . '&posts_per_page=1' );
 }}}

 This works fine for:

 http://domain.tld/category/cat/subcat/page/1 and
 http://domain.tld/category/cat/subcat/page/2

 Remember 9 posts in that subcategory and a default posts per page value of
 5. If I point my browser to:

 http://domain.tld/category/cat/subcat/page/3

 I get a "not found page" (not a 404) with the search form on it. So i
 added this code to the searchform.php:

 {{{
 <?php echo"Query:". urldecode($query_string;)?>
 }}}

 The result is: paged=3&category_name=cat/subcat The posts_per_page is
 missing.

 After figured out this, I changed the posts per page in the WP settings to
 1 and it worked, as it should. Changing it to 3 it works till page 3 and i
 have the same effect on page 4.

 This is why it seems to me, that the posts_per_page attributes gets lost
 during processing and then is overwritten with the default value.

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


More information about the wp-trac mailing list