[wp-trac] [WordPress Trac] #34707: Separate out the namespace from the path in rest_url
WordPress Trac
noreply at wordpress.org
Wed Nov 18 01:06:23 UTC 2015
#34707: Separate out the namespace from the path in rest_url
--------------------------+------------------------------
Reporter: rmccue | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses:
--------------------------+------------------------------
Comment (by rmccue):
The main use case I can think of is in controllers, you may have the
namespace and route separate already, so to generate URLs, you'd need to
build the string yourself. I don't think that's a huge issue.
If we did allow an array, we'd have something like...
{{{
register_rest_route( $this->namespace, $this->route, array( /* ... */ ) );
// Current style
$url = get_rest_url( $this->namespace . '/' . $this->route );
// New style
$url = get_rest_url( array( $this->namespace, $this->route ) );
}}}
@wonderboymusic I think it was you that originally suggested splitting the
args here. Was there a particular reason for that?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34707#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list