AnsPress_REST_API::register_routes()
Description #
Register the /wp-json/myplugin/v1/foo route
Source #
File: includes/wp-api.php
public function register_routes() {
register_rest_route( $this->namespace, 'answers/(?P<id>\d+)', array(
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_answers' ],
'args' => array(
'id' => array(
'validate_callback' => 'is_numeric'
),
),
) );
}
Expand full source code Collapse full source code View on GitHub: includes/wp-api.php:29
Add your comment