rest_url
Filters the REST URL.
Use this filter to adjust the url returned by the get_rest_url() function.
Использование
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(строка)
- REST URL.
- $path(строка)
- REST route.
- $blog_id(int|null)
- Blog ID.
- $scheme(строка)
- Sanitization scheme.
Список изменений
| С версии 4.4.0 | Введена. |
Где вызывается хук
rest_url
wp-includes/rest-api.php 556
return apply_filters( 'rest_url', $url, $path, $blog_id, $scheme );