[wp-trac] [WordPress Trac] #14195: $paged is not set when a Static Page is set as the Front Page

WordPress Trac wp-trac at lists.automattic.com
Sun Jul 4 15:12:10 UTC 2010


#14195: $paged is not set when a Static Page is set as the Front Page
--------------------------+-------------------------------------------------
 Reporter:  der           |       Owner:                   
     Type:  defect (bug)  |      Status:  new              
 Priority:  normal        |   Milestone:  Awaiting Review  
Component:  General       |     Version:  3.0              
 Severity:  normal        |    Keywords:  pagination, paged
--------------------------+-------------------------------------------------
 If a static page is set as the front page of your WordPress site, and you
 request paginated content from the page via its URL (with permalinks
 enabled or disabled, doesn't matter), the $paged variable is not set.

 This causes custom pages (those ones displaying posts), to always go to
 Page 1, even if you click other pages. ( This is happening because $paged
 is set to null, and if it's set to null, it always goes to page 1).

 Also, get_query_var('paged'), also returns null, when it should return
 page 2 (if you clicked on page 2 for example).

 After inspecting $wp_query, I noticed that the correct paginated value is
 stored on
 {{{
 $wp_query->query['paged']
 }}}

 So, I have to do the following on all my themes on header.php, so the
 pagination doesn't break:

 {{{
 global $wp_query, $paged;
 $paged = $wp_query->query['paged'];
 }}}

 This sets $paged again,with the correct value from $wp_query and fixes the
 bug. Since $paged is null whenever a custom page is selected as your
 homepage.

 This fix works with permalinks enabled or disabled.

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


More information about the wp-trac mailing list