Opened 9 years ago
Last modified 7 years ago
#37505 new defect (bug)
Filtering pagination when the pagenumber doesn't exist.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.5.3 |
| Component: | Canonical | Keywords: | |
| Focuses: | Cc: |
Description
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! – 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.
Previously: #11694, #21278,