[wp-trac] [WordPress Trac] #37505: Filtering pagination when the pagenumber doesn't exist.

WordPress Trac noreply at wordpress.org
Fri Jul 29 05:10:51 UTC 2016

#37505: Filtering pagination when the pagenumber doesn't exist.
 Reporter:  Cybr          |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Canonical     |    Version:  4.5.3
 Severity:  normal        |   Keywords:
  Focuses:                |
 Hello :).

 `WP_Query::page` or `$GLOBALS['page']` or `get_query_var( 'page' );` will
 return whatever value is set by the visitor on a non-paginated page or

 On a paginated page/post, it will 301 redirect the visitor to the first
 page, this is OK.

 '''An example, on a post or page without pagination:'''

 The output of the page will be incorrect, specifically on these two parts
 (both Title and Canonical URL show pagination).
 URL: `http://example.com/2016/07/29/hello-world/123/`
 <title>Hello world! – Page 123 – Example.com</title>
 <link rel="canonical" href="http://example.com/2016/07/29/hello-
 world/123/" />

 This is a major concern for SEO, as it will output duplicated pages.
 Abusers could mark otherwise good pages as duplicated by simply linking to
 a non-existing non-paginated page.

 '''My suggestion:'''
 Check against `$GLOBALS['multipage']` (or `$GLOBALS['numpages']`) prior to
 creating the above output.

Ticket URL: <https://core.trac.wordpress.org/ticket/37505>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list