[wp-trac] [WordPress Trac] #35794: redirect_canonical doesn't strip off custom feed endings

WordPress Trac noreply at wordpress.org
Wed Feb 10 13:54:44 UTC 2016


#35794: redirect_canonical doesn't strip off custom feed endings
--------------------------+-----------------------------
 Reporter:  huyby         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Canonical     |    Version:  3.9
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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:

 {{{#!php
  $feedssubpattern = implode('|', array_map(function($val) { return
 preg_quote($val, '#'); }, $wp_rewrite->feeds));
  $pattern = '#/(comments/?)?(' . $feedssubpattern . ')(/+)?$#';
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35794>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list