Make WordPress Core

Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#44587 closed enhancement (duplicate)

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

Reported by: ekatherine's profile ekatherine Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.7
Component: Permalinks Keywords: has-patch
Focuses: Cc:


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:

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 6 years ago.

Download all attachments as: .zip

Change History (8)

#1 @ekatherine
6 years 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
6 years ago

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

#3 @ianbelanger
6 years 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.


6 years ago


#4 @ekatherine
6 years 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.

#5 @ekatherine
4 years ago

It's been a year and a half lol, and still no response

Last edited 4 years ago by ekatherine (previous) (diff)

#6 @SergeyBiryukov
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome to WordPress Trac! Thanks for the report, sorry it took so long for someone to get back to you.

Just noting that we're already tracking this issue in #45337 and #28081, so I'm going to close this one in favor of those tickets, as they have some more details in the comments. Also related: #48972.

#7 @SergeyBiryukov
4 years ago

Just noting this ended up being fixed in [47727] / #40773.

Note: See TracTickets for help on using tickets.