rest_url filter-hookWP 4.4.0

Filters the REST URL.

Use this filter to adjust the url returned by the get_rest_url() function.

Usage

add_filter( 'rest_url', 'wp_kama_rest_url_filter', 10, 4 );

/**
 * Function for `rest_url` filter-hook.
 * 
 * @param string   $url     REST URL.
 * @param string   $path    REST route.
 * @param int|null $blog_id Blog ID.
 * @param string   $scheme  Sanitization scheme.
 *
 * @return string
 */
function wp_kama_rest_url_filter( $url, $path, $blog_id, $scheme ){

	// filter...
	return $url;
}
$url(string)
REST URL.
$path(string)
REST route.
$blog_id(int|null)
Blog ID.
$scheme(string)
Sanitization scheme.

Changelog

Since 4.4.0 Introduced.

Where the hook is called

get_rest_url()
rest_url
wp-includes/rest-api.php 521
return apply_filters( 'rest_url', $url, $path, $blog_id, $scheme );

Where the hook is used in WordPress

Usage not found.