[wp-trac] [WordPress Trac] #49749: Bug in WordPress API when I have the prefix wp for the custom endpoint

WordPress Trac noreply at wordpress.org
Wed Apr 1 11:07:37 UTC 2020


#49749: Bug in WordPress API when I have the prefix wp for the custom endpoint
-------------------------------------+------------------------------
 Reporter:  skarabeq                 |       Owner:  (none)
     Type:  defect (bug)             |      Status:  assigned
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  REST API                 |     Version:  5.4
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch 2nd-opinion  |     Focuses:
-------------------------------------+------------------------------

Comment (by skarabeq):

 @afercia, I do not agree with you. I have use this namespace `/wp/v2` more
 than 2 years. So this isn't "accident".
 @TimothyBlynJacobs about this code which is in your core:


 {{{#!php
 <?php
 $full_route = '/' . trim( $namespace, '/' ) . '/' . trim( $route, '/' );
 }}}

 And your suggested code

 {{{#!php
 <?php
 $namespace = trim( $namespace, '/' );
 $full_route = '/' . $namespace . '/' . trim( $route, '/' );
 }}}


 The output of the `$full_route` will be same.

 [[Image(https://imgur.com/CGz2lHM)]]
 [[Image(https://imgur.com/0nGqSCM)]]

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


More information about the wp-trac mailing list