[wp-trac] [WordPress Trac] #34302: get_rest_url() should not include a trailing slash by default

WordPress Trac noreply at wordpress.org
Thu Oct 15 07:37:04 UTC 2015


#34302: get_rest_url() should not include a trailing slash by default
--------------------------+----------------------
 Reporter:  johnbillion   |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  REST API      |     Version:  trunk
 Severity:  normal        |  Resolution:  invalid
 Keywords:  needs-patch   |     Focuses:
--------------------------+----------------------
Changes (by rmccue):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  4.4 =>


Comment:

 This is intentional; see https://github.com/WP-API/WP-API/pull/1426 and
 https://github.com/WP-API/WP-API/pull/1467

 Basically, the REST API works a bit differently. Rather than default to no
 `$path`, we default to the index at `/`. Without a route is an error,
 since there's no empty-string route (we obviously treat it as '/' to avoid
 errors, but you shouldn't ever do that).

 `$path` is probably the wrong thing to call it, and I think we want to add
 `$namespace` in as well, so the eventual signature should probably
 actually be:
 {{{
 get_rest_url( $blog_id = null, $namespace = '', $route = '/', $scheme =
 'rest' )
 }}}

 I'll open a new ticket for that.

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


More information about the wp-trac mailing list