钩子文档

includes_url

💡 云策文档标注

概述

本文档介绍了 WordPress 中的 includes_url 过滤器,用于修改指向 wp-includes 目录的 URL。该过滤器允许开发者自定义 URL 的路径和协议方案。

关键要点

  • includes_url 过滤器用于过滤 wp-includes 目录的完整 URL,包括方案和路径。
  • 参数包括 $url(完整 URL)、$path(相对路径)和 $scheme(协议方案,如 'http'、'https'、'relative' 或 null)。
  • 该过滤器在 WordPress 2.8.0 中引入,并在 5.8.0 版本中添加了 $scheme 参数。
  • 相关函数 includes_url() 用于检索 includes 目录的 URL。

📄 原文内容

Filters the URL to the includes directory.

Parameters

$urlstring
The complete URL to the includes directory including scheme and path.
$pathstring
Path relative to the URL to the wp-includes directory. Blank string if no path is specified.
$schemestring|null
Scheme to give the includes URL context. Accepts 'http', 'https', 'relative', or null. Default null.

Source

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

Changelog

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