Create a new endpoint
-
Hello,
We are trying to create a custom endpoint within REST-API plugin.
This page (http://v2.wp-api.org/extending/adding/) is not really explicit on which files must be created/updated.We created a new controller in /lib/endpoints/ with new route & function.
This route is not working:
add_action( ‘rest_api_init’, function () {
register_rest_route( ‘wp/v2’, ‘/partner/(?P<slug>\d+)’, array(
‘methods’ => ‘GET’,
‘callback’ => ‘get_post_partner’
));
});can you help?
thanks,
Guillaume
The topic ‘Create a new endpoint’ is closed to new replies.