user_dashboard_url
云策文档标注
概述
user_dashboard_url 是一个 WordPress 过滤器,用于修改用户的仪表板 URL。它允许开发者自定义 URL 的生成逻辑,基于用户 ID、路径和方案等参数。
关键要点
- 这是一个过滤器钩子,用于过滤用户仪表板的 URL。
- 接受参数包括:$url(完整 URL)、$user_id(用户 ID)、$path(相对路径)和 $scheme(URL 方案)。
- 常用于 get_dashboard_url() 函数中,以提供灵活的 URL 定制。
代码示例
apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme );注意事项
- 从 WordPress 3.1.0 版本开始引入。
- 方案参数接受 'http'、'https'、'login'、'login_post'、'admin'、'relative' 或 null。
原文内容
Filters the dashboard URL for a user.
Parameters
$urlstring-
The complete URL including scheme and path.
$user_idint-
The user ID.
$pathstring-
Path relative to the URL. Blank string if no path is specified.
$schemestring-
Scheme to give the URL context. Accepts
'http','https','login','login_post','admin','relative'or null.
Source
return apply_filters( 'user_dashboard_url', $url, $user_id, $path, $scheme );
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |