Make WordPress Core

Opened 4 years ago

Last modified 23 months ago

#50233 reopened defect (bug)

Limit pagination for comments

Reported by: devrekli's profile devrekli Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: minor Version: 5.4.1
Component: Permalinks Keywords: has-patch has-unit-tests needs-testing dev-feedback
Focuses: Cc:

Description

you can look? please https://wordpress.org/support/topic/wordpress-infinite-link-problem/

Hello. WordPress has endless link problems for many years. Note: This problem happens when we paged comment example:

Others:

https://perishablepress.com/wordpress-infinite-duplicate-content/comment-page-2/
https://perishablepress.com/wordpress-infinite-duplicate-content/comment-page-2754/

others

https://www.wpbeginner.com/beginners-guide/how-to-properly-ask-for-wordpress-support-and-get-it/comment-page-2754/
https://www.wpbeginner.com/beginners-guide/how-to-properly-ask-for-wordpress-support-and-get-it/comment-page-5754/

others

https://www.isitwp.com/best-wordpress-404-error-plugins/comment-page-3754/
https://www.isitwp.com/best-wordpress-404-error-plugins/comment-page-5754/

Attention! There are no comments on these pages. But the links are entering the article. This is the problem for google search console.

If there is no comment, that link should not work. How can I fix this?

Paged comments from your admin panel. And you try too

If we do not paginate, this is no problem.

This problem happens in paginations..

If the setting is like this. screen shot: https://prnt.sc/smhi90

Attachments (5)

50233.patch (1.6 KB) - added by sumanm 3 years ago.
This patch adds page limitation for comments non existing page and redirect to parent post
50233.1.diff (2.5 KB) - added by sumanm 3 years ago.
added unit tests for comments limit pagination
50233.2.patch (2.2 KB) - added by mukesh27 3 years ago.
Minor changes
50233.3.diff (2.3 KB) - added by audrasjb 3 years ago.
patch refreshed against trunk, coding standards fixes and @since refresh
50233.4.diff (3.9 KB) - added by costdev 2 years ago.
Adds these changes to src/wp-includes/link-template.php. Tests pass. Do not commit this patch.

Download all attachments as: .zip

Change History (31)

#1 follow-up: @carike
4 years ago

  • Component changed from Canonical to Permalinks
  • Severity changed from critical to minor
  • Summary changed from WordPress Infinite link problem? to Limit pagination
How can I fix this?

:wave:
Hallo :)
As I indicated on the support forums, for a timely solution, you may want to consider hiring a developer to create a custom plugin, if this is important to you.

In terms of this Trac ticket:

The issue:
Paginated pages with no entries display the original post.
Here is an example: https://wordpress.org/support/topic/wordpress-infinite-link-problem/page/12345/

The proposed solution:
When a permalink is evaluated for a paginated URL, it should check if the particular page "exists" (contains entries), not just whether the post exists.
If there are no entries on the paginated URL, the visitor should be redirected to the original post's URL.

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

#2 in reply to: ↑ 1 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 5.5
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted
  • Summary changed from Limit pagination to Limit pagination for comments

Replying to carike:

The issue:
Paginated pages with no entries display the original post.
Here is an example: https://wordpress.org/support/topic/wordpress-infinite-link-problem/page/12345/

Just noting that particular issue is being tracked in #28081.

This ticket is a reporting a similar, but distinct issue for paginated comments, which was previously noted in comment:6:ticket:11694, but never addressed in that ticket.

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

#3 @SergeyBiryukov
4 years ago

  • Milestone changed from 5.5 to 5.6

@sumanm
3 years ago

This patch adds page limitation for comments non existing page and redirect to parent post

#4 @sumanm
3 years ago

  • Keywords has-patch added

@sumanm
3 years ago

added unit tests for comments limit pagination

#5 @sumanm
3 years ago

  • Keywords has-unit-tests added

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


3 years ago

@mukesh27
3 years ago

Minor changes

#7 @mukesh27
3 years ago

In 50233.2.patch added some minor text and space changes.

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


3 years ago

#9 @SergeyBiryukov
3 years ago

  • Milestone changed from 5.6 to 5.7

Didn't get a chance to review this in time for 5.6 RC, moving to the next release for now.

#10 @lukecarbis
3 years ago

  • Milestone changed from 5.7 to 5.8

This ticket was mentioned in Slack in #core by chaion07. View the logs.


3 years ago

#12 @chaion07
3 years ago

Thanks @devrekli for reporting the issue. We reviewed this ticket during a [recent triage session]https://wordpress.slack.com/archives/C02RQBWTW/p1622577969164000. It would be great if others can review the patch as well.

Drawing kind attention from @asif2bd as the component maintainer for Permalink. Thank you!

@audrasjb
3 years ago

patch refreshed against trunk, coding standards fixes and @since refresh

#13 @audrasjb
3 years ago

In 50233.3.diff, I refreshed the previous patch against trunk, fixed some coding standards issues and I refreshed @since mentions.

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


3 years ago

#15 @whyisjake
3 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 51118:

Permalinks: Limit pagination for posts with comments.

Additionally, redirect pages back to the source page if comments don't exist.

Props devrekli, carike, sumanm, mukesh27, chaion07, audrasjb, whyisjake, SergeyBiryukov.

Fixes #50233.

#16 @whyisjake
3 years ago

In 51125:

Permalinks: Revert the changes stemming from pagination limits.

In [51118], an attempt was made to add pagination limits. The added tests need to be updated to ensure that they pass with the new changes.

Reverts [51118].

See #50233.

#17 @whyisjake
3 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#18 @whyisjake
3 years ago

  • Milestone changed from 5.8 to Future Release

#19 @SergeyBiryukov
3 years ago

  • Milestone changed from Future Release to 5.9

#20 @devrekli
3 years ago

you haven't fixed it for a long time

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


2 years ago

@costdev
2 years ago

Adds these changes to src/wp-includes/link-template.php. Tests pass. Do not commit this patch.

#22 @costdev
2 years ago

  • Keywords needs-testing added

Patch 50233.4.diff adds these changes to src/wp-includes/link-template.php. This makes the unit test pass.

However, this raises the following questions:

  1. Is wp_get_canonical_url() the correct method to use in the existing unit test?
    • If not, the correct method should be determined and the unit test corrected.
  1. Does 50233.3.diff work with manual testing?
  1. Does 50233.4.diff work with manual testing?
  1. Does 50233.4.diff work without the changes to src/wp-includes/canonical.php?
    • If not:
      • Both src/wp-includes/canonical.php and src/wp-includes/link-template.php need to be patched.
      • More tests are needed to properly test the changes in src/wp-includes/canonical.php.

Adding needs-testing so this can be picked up by the Test team and suggest moving this to the Future Release milestone as it still needs work.

Last edited 2 years ago by costdev (previous) (diff)

#23 @hellofromTonya
2 years ago

  • Milestone changed from 5.9 to 6.0

More testing and discussion is needed. Moving to 6.0.

This ticket was mentioned in Slack in #core by costdev. View the logs.


2 years ago

#25 @costdev
2 years ago

  • Keywords dev-feedback added

Per the discussion in the bug scrub, I'm adding dev-feedback.

Some comments from @ironprogrammer:

  • This should be checked against the new Comments Query Loop as well, in case there is any overlapping functionality.
  • Redirecting URLs that exceed the max makes sense, though I haven’t looked at the patches yet. Nobody has chimed in about it breaking backward compat, so this looks like a straightforward SEO win?

#26 @peterwilsoncc
23 months ago

  • Milestone changed from 6.0 to Future Release

Redirecting URLs that exceed the max makes sense, though I haven’t looked at the patches yet. Nobody has chimed in about it breaking backward compat, so this looks like a straightforward SEO win?

I think redirecting might be problematic:

  • 301 Permanent redirects are cached by the browser permanently. Someone visiting page two of the comments before it exists would never be able to visit page two of the comments
  • 302|307 Temporary redirects can be indexed by search engines as I understand it.

(Someone working in the WordPress SEO space may wish to correct me.)

I think the best option would be to either:

  • show a 404 page if the comments page doesn't yet exist
  • ensure the canonical tag points to the post's default page and the comments on that page are displayed.

My preference is leaning towards a 404 page.

As this hasn't had any substantial work on it during the 6.0 cycle, I'm going to move the ticket on to a future release.

Note: See TracTickets for help on using tickets.