Opened 9 years ago
Last modified 6 years ago
#35794 new defect (bug)
redirect_canonical doesn't strip off custom feed endings
Reported by: | huyby | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.9 |
Component: | Canonical | Keywords: | needs-patch |
Focuses: | Cc: |
Description
The pattern used for matching URL's with feed endings (e.g. /feed/atom/) isn't matching any custom defined feeds. For example, if you add 'json' as a new type of feed, the redirect_canonical function adds up the feed ending to the current request URL.
This is caused by fixed regular expressions used to match such feed URL's. These regular expressions should be generated using the $wp_rewrite->feeds variable:
$feedssubpattern = implode('|', array_map(function($val) { return preg_quote($val, '#'); }, $wp_rewrite->feeds));
$pattern = '#/(comments/?)?(' . $feedssubpattern . ')(/+)?$#';
Attachments (2)
Change History (4)
#1
@
9 years ago
- Keywords needs-patch added
Thanks for the report and the patch, @huyby!
It looks like your command line is piped through something that adds colour coding, and the markings for this are present in your patch file. Are you able to regenerate your patch without the colour coding in place please?
Note: See
TracTickets for help on using
tickets.
patch