Closed schoenkaft closed 5 years ago
@HammenWS update:
Grrr\Rest\Routes
namespace/class where you can specify the global namespace and custom routes/
in front of it, but I'm okay with this for now)$list
argument). Too complex for what we tried to achieve in this case.email
validation, since that was missing...PS: did not update the wiki, since the article about REST routes is still to be written. Plus adding a route this way just works, no need to worry about the security part.
The class now returns:
Routes::NAMESPACE;
// grrr/v1
Routes::get('newsletter');
// newsletter/subscribe
Routes::get_all();
// [ '/grrr/v1/newsletter/subscribe' ]
Routes::get_all(false);
// [ 'newsletter/subscribe' ]
Routes::url('newsletter');
// http://localhost.wordpress-scaffold.nl/wp-json/newsletter/subscribe
This is mainly because exposing (admin) users could subject them to personalised hacks. Plus to prevent accidental exposure of sensitive post types or fields (although that would require additional work to do so).