rest_url
云策文档标注
概述
rest_url 过滤器用于调整 get_rest_url() 函数返回的 REST URL,允许开发者自定义 URL 的生成。
关键要点
- 过滤器名称:rest_url
- 用途:修改 REST URL,适用于自定义路由或调整 URL 结构
- 参数:$url(REST URL)、$path(REST 路由)、$blog_id(博客 ID)、$scheme(消毒方案)
- 相关函数:get_rest_url(),用于获取站点的 REST 端点 URL
- 引入版本:WordPress 4.4.0
原文内容
Filters the REST URL.
Description
Use this filter to adjust the url returned by the get_rest_url() function.
Parameters
$urlstring-
REST URL.
$pathstring-
REST route.
$blog_idint|null-
Blog ID.
$schemestring-
Sanitization scheme.
Source
return apply_filters( 'rest_url', $url, $path, $blog_id, $scheme );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |