WP_REST_Server::get_namespaces() WordPress Method

The WP_REST_Server::get_namespaces() method is used to get the list of available REST API namespaces. This can be useful for introspecting what API endpoints are available.

WP_REST_Server::get_namespaces() #

Retrieves namespaces registered on the server.


Return

(string[]) List of registered namespaces.


Top ↑

Source

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

	public function get_namespaces() {
		return array_keys( $this->namespaces );
	}


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.