[wp-trac] [WordPress Trac] #15551: Custom post type pagination redirect

WordPress Trac noreply at wordpress.org
Thu Jan 28 16:44:32 UTC 2016


#15551: Custom post type pagination redirect
------------------------------------------+-----------------------------
 Reporter:  cbsad                         |       Owner:
     Type:  defect (bug)                  |      Status:  reopened
 Priority:  normal                        |   Milestone:  Future Release
Component:  Query                         |     Version:  3.1
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+-----------------------------

Comment (by DzeryCZ):

 I have this problem too.

 I have set custom page as Front page, and that page has set custom
 template with posts loop.

 When the permalinks are set to different value than "Default", paged URL
 is  redirected to homepage. (E.g. www.example.com/page/3 ->
 www.example.com)


 ----

 Just question: Why are in WordPress used two different query vars for
 pagination?

 I mean get_query_var('page') vs get_query_var('pages') I know one is used
 on is_home() (main blog) and second one is used in archives. But why you
 cannot merge it up?


 I've tried to add this code:

 {{{#!php
 <?php
 if(!!get_query_var('page'))
         set_query_var('paged', get_query_var('page'));

 }}}

 into /wp-includes/canonical.php - function redirect_canonical() (line 45)
 and it helps. But I don't know whether it cause problem somewhere else.

 +

 In query in my custom page template cannot be set "offset".

 {{{#!php
 <?php
 if (is_front_page()) {
     unset($args['offset']);
 }
 $wp_query = new WP_Query($args);
 }}}



 Many thanks for any answers.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/15551#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list