Make WordPress Core

Opened 8 years ago

Last modified 5 years ago

#37505 new defect (bug)

Filtering pagination when the pagenumber doesn't exist.

Reported by: cybr's profile 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).

<title>Hello world! &#8211; Page 123 &#8211;</title>
<link rel="canonical" href="" />

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.