Make WordPress Core

Opened 15 months ago

Last modified 14 months ago

#44587 new enhancement

Page variable is not compared to actual pages count on single post

Reported by: ekatherine Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.7
Component: Permalinks Keywords: has-patch
Focuses: Cc:
PR Number:


Since there's no check if page value more than actual pages count (by this I mean the number of '<!--nextpage-->' occurs), it's possible to create a billion of links with the same content but with different page value. I even caught this bug on this blog: https://wordpress.org/news/2018/07/update-on-gutenberg/9999/

I guess it's not good for SEO.

I managed to fix this on my website (which is on the latest version 4.9.7) by editing the file wp/wp-includes/canonical.php, now it redirects user to the last available page (or removes page part from the address if there's only one page).

Attachments (1)

canonical.php (27.9 KB) - added by ekatherine 14 months ago.

Download all attachments as: .zip

Change History (5)

#1 @ekatherine
15 months ago

  • Keywords has-patch added

I guess I have to wait much longer for this ticket to be reviewed?
Well, I think I can say I have a patch although it needs proper testing

#2 @ekatherine
14 months ago

Is someone gonna take a look at it or what?.. :(

#3 @ianbelanger
14 months ago

  • Keywords needs-patch added; has-patch removed

Hi @ekatherine,

Enhancements usually don't get reviewed as quickly as bug reports do. However, if you do have a patch for this, you should upload it to this ticket because it is more likely to get reviewed by a core committer. I would be happy to test it for you once the patch is submitted.


14 months ago


#4 @ekatherine
14 months ago

  • Keywords has-patch added; needs-patch removed

@ianbelanger thanks for your message!

Well, I'm sorry, it's just that I'm not sure that's not a bug :) And no one took a look to check if it's under the right category.

Ok. Here is my attachment. It's a modified wp-includes/canonical.php file. Tested it with the latest version and it worked fine for me.

Note: See TracTickets for help on using tickets.