WP_REST_Server::get_route_options() WordPress Method

The WP_REST_Server::get_route_options() method returns an array of options for the given route. The array includes the ' methods ', ' accepts_json ', and ' _overrides ' options.

WP_REST_Server::get_route_options( string $route ) #

Retrieves specified options for a route.


Parameters

$route

(string)(Required)Route pattern to fetch options for.


Top ↑

Return

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


Top ↑

Source

File: wp-includes/rest-api/class-wp-rest-server.php

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

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


Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.