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'
					),
				),
		) );
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment