[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:22:44 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 TimothyBlynJacobs):

 > The output of the $full_route will be same.

 @skarabeq the output of the full route is the same, but notice that the
 namespace passed will now be forced to have correct formatting.

 >  I do not agree with you. I have use this namespace /wp/v2 more than 2
 years. So this isn't "accident".

 I do not believe that prefixing the namespace with a slash is expected
 behavior, and I agree with @afercia that it is documented fairly clearly.

 The existing routing worked because of the coercion that was applied. But
 this was previously broken in other ways. Any code that relied upon a
 valid namespace value would be broken. For example, you can see this when
 doing a request for `/wp-json/wp/v2`, the `nav` endpoint won't be listed.

 That doesn't mean we won't also add that coercion to the namespace
 parameter as I described earlier. But I think your best course of action
 would be to correct your route definition while we wait for 5.4.1.

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


More information about the wp-trac mailing list