WP_REST_Server::get_route_options()publicWP 4.4.0

Retrieves specified options for a route.

Method of the class: WP_REST_Server{}

No Hooks.

Return

Array|null. Data as an associative array if found, or null if not found.

Usage

$WP_REST_Server = new WP_REST_Server();
$WP_REST_Server->get_route_options( $route );
$route(string) (required)
Route pattern to fetch options for.

Changelog

Since 4.4.0 Introduced.

WP_REST_Server::get_route_options() code WP 6.5.2

public function get_route_options( $route ) {
	if ( ! isset( $this->route_options[ $route ] ) ) {
		return null;
	}

	return $this->route_options[ $route ];
}