rest_get_url_prefix() WordPress Function

The rest_get_url_prefix() function is used to retrieve the URL prefix for any REST API requests. This can be useful for debugging or for creating custom endpoints. The prefix is typically 'wp-json'.

rest_get_url_prefix() #

Retrieves the URL prefix for any API resource.


Return

(string) Prefix.


Top ↑

Source

File: wp-includes/rest-api.php

function rest_get_url_prefix() {
	/**
	 * Filters the REST URL prefix.
	 *
	 * @since 4.4.0
	 *
	 * @param string $prefix URL prefix. Default 'wp-json'.
	 */
	return apply_filters( 'rest_url_prefix', 'wp-json' );
}


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.

Show More