[wp-trac] [WordPress Trac] #43539: Custom feed types breaks redirect_canonical behavior

WordPress Trac noreply at wordpress.org
Sat Mar 17 18:43:55 UTC 2018


#43539: Custom feed types breaks redirect_canonical behavior
--------------------------+------------------------------
 Reporter:  satantime     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Canonical     |     Version:  4.9.4
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by satantime):

 Might you pay more attention to details which I gave in the description?
 As I told this plugin is just an example when redirect_canonical doesn't
 work properly.
 You don't get redirect because of infinity redirect which always adds one
 more /feed/test to your: http://take.ms/YLhV6

 to simulate custom feed please add to functions.php of your current theme
 something like that:

 {{{#!php
 add_action('init', 'test_feed');
 function test_feed()
 {
     add_feed('test', 'void');
 }

 add_filter('request', 'test_request');
 function test_request($value)
 {
     $value = array(
         'feed' => 'test',
     );
     return $value;
 }
 }}}

 now you have custom feed type "test".
 then add debug output there: http://take.ms/Ajkjb
 {{{#!php
 header('Content-Type: text/plain');
 var_dump($redirect_url);
 exit;
 }}}
 now try to access localhost/feed/test or localhost/feed/test/
 and you'll see https://localhost/feed/test/feed/test/

 why it's https://localhost/feed/test/feed/test/ you can read in
 description with proposed fix.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43539#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list