Create a new endpoint
-
Hello,
We are trying to create a custom endpoint within REST-API plugin.
This page (https://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
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Create a new endpoint’ is closed to new replies.