Make WordPress Core

Opened 4 years ago

Last modified 13 months ago

#37505 new defect (bug)

Filtering pagination when the pagenumber doesn't exist.

Reported by: Cybr Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.3
Component: Canonical Keywords:
Focuses: Cc:


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 post.

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! &#8211; Page 123 &#8211; 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.

Change History (1)

Note: See TracTickets for help on using tickets.