Opened 9 years ago
Last modified 5 months ago
#39535 new defect (bug)
Canonical redirects disallow tag named comments
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Canonical | Keywords: | has-patch has-unit-tests changes-requested |
| Focuses: | Cc: |
Description
The redirect_canonical function includes a regular expression replacement which effectively disallows tags named "comments" to have an RSS feed:
https://github.com/WordPress/WordPress/blob/master/wp-includes/canonical.php#L285
For example:
/blog1/tag/comments/feed/
This is redirected to:
/blog1/tag/feed/
Could / should the regular expression on line 285 could pay attention to the first placeholder it matched (comments/?) or check whether the page is a tag request?
Attachments (2)
Change History (21)
#2
@
9 years ago
@dd32 @markjaquith I looked a bit at the source code and this seems like it has been around for a while. Sorry to pull you in on this one, not sure who would be assigned :)
Here is the commit on Git:
https://github.com/WordPress/WordPress/commit/ecffc4649f4cb90b43fe0b38ab0f4b18967cb3fd
I was able to reproduce the bug myself, real easy to do so. Just create a tag named "comments" and then try to load the rss feed for the tag: http://URL/tag/comments/feed/
This ticket was mentioned in Slack in #core by asalce. View the logs.
9 years ago
#6
@
9 years ago
@swissspidy I submitted the unit-test, The best way I could test this out was to test if the query vars were set correctly after a go_to("/tag/comments/feed/") the query vars should have a "feed" and "tag" should equal "comments" , I also added some other tests to make sure tests were running correctly.
@dwc perfect! :)
This ticket was mentioned in Slack in #core by asalce. View the logs.
9 years ago
This ticket was mentioned in Slack in #core by asalce. View the logs.
9 years ago
#10
in reply to:
↑ 9
@
9 years ago
Replying to SergeyBiryukov:
I ran into this bug with another site, Any chance this could be moved into 4.7.x ?
This ticket was mentioned in Slack in #core by obenland. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by asalce. View the logs.
8 years ago
#15
@
7 years ago
Can this one also be put up for review?
https://make.wordpress.org/core/2019/02/20/reverting-the-bulk-ticket-closing/ @obenland @JeffPaul
#16
@
7 years ago
@asalce I don't think this ticket relates to the bulk ticket closing, but if you're asking about getting this milestoned then your best bet is to check with the Canonical component maintainers (see https://make.wordpress.org/core/components/permalinks/canonical/).
#17
@
7 years ago
@JeffPaul Thanks!
@markjaquith this ticket has been in my account for a bit. I supplied a patch and unit testing awhile ago. Let me know what else is needed to get this into a release. Thanks!
- Alberto S.
This ticket was mentioned in PR #8981 on WordPress/wordpress-develop by @SirLouen.
5 months ago
#18
- Keywords has-unit-tests added; needs-unit-tests removed
This patch is not working. Unit Tests not passing. Needs more work.
Trac ticket: https://core.trac.wordpress.org/ticket/39535
@dwc I attached a patch which should work. The safest way was to check against the generated site-wide comments feed. Could you take look and let me know if that solves your issue?