钩子文档

set_url_scheme

💡 云策文档标注

概述

set_url_scheme 是一个 WordPress 过滤器,用于在设置 URL 方案后对生成的 URL 进行过滤。它允许开发者修改 URL 的最终输出。

关键要点

  • 过滤器名称:set_url_scheme
  • 参数:$url(完整 URL)、$scheme(应用的方案,如 'http'、'https' 或 'relative')、$orig_scheme(请求的方案,如 'http'、'https'、'login'、'login_post'、'admin'、'relative'、'rest'、'rpc' 或 null)
  • 用途:在 set_url_scheme() 函数中调用,用于自定义 URL 方案设置后的结果
  • 引入版本:WordPress 3.4.0

📄 原文内容

Filters the resulting URL after setting the scheme.

Parameters

$urlstring
The complete URL including scheme and path.
$schemestring
Scheme applied to the URL. One of 'http', 'https', or 'relative'.
$orig_schemestring|null
Scheme requested for the URL. One of 'http', 'https', 'login', 'login_post', 'admin', 'relative', 'rest', 'rpc', or null.

Source

return apply_filters( 'set_url_scheme', $url, $scheme, $orig_scheme );

Changelog

Version Description
3.4.0 Introduced.