钩子文档

user_admin_url

💡 云策文档标注

概述

user_admin_url 是一个 WordPress 过滤器钩子,用于修改当前用户的管理后台 URL。它允许开发者自定义 URL 的路径和方案。

关键要点

  • 钩子名称:user_admin_url
  • 参数:$url(完整 URL)、$path(相对路径)、$scheme(方案,如 'http'、'https'、'admin' 或 null)
  • 默认方案为 'admin',遵循 force_ssl_admin() 和 is_ssl() 设置
  • 相关函数:user_admin_url() 用于获取当前用户的管理后台 URL
  • 版本历史:在 5.8.0 版本添加 $scheme 参数,3.1.0 版本引入

📄 原文内容

Filters the user admin URL for the current user.

Parameters

$urlstring
The complete URL including scheme and path.
$pathstring
Path relative to the URL. Blank string if no path is specified.
$schemestring|null
The scheme to use. Accepts 'http', 'https', 'admin', or null. Default is 'admin', which obeys force_ssl_admin() and is_ssl() .

Source

return apply_filters( 'user_admin_url', $url, $path, $scheme );

Changelog

Version Description
5.8.0 The $scheme parameter was added.
3.1.0 Introduced.