wp_sitemaps_stylesheet_url
云策文档标注
概述
wp_sitemaps_stylesheet_url 是一个 WordPress 过滤器,用于修改站点地图样式表的 URL。如果返回假值,站点地图将显示原始 XML 而不使用样式表。
关键要点
- 这是一个过滤器 Hook,允许开发者自定义站点地图样式表的 URL。
- 参数 $sitemap_url 是一个字符串,表示站点地图 XSL 文件的完整 URL。
- 如果过滤器返回 falsey 值(如 false、null、空字符串等),站点地图将不应用样式表,直接显示原始 XML。
- 该过滤器在 WP_Sitemaps_Renderer::get_sitemap_stylesheet_url() 方法中被调用,用于获取样式表 URL。
- 此过滤器自 WordPress 5.5.0 版本引入。
原文内容
Filters the URL for the sitemap stylesheet.
Description
If a falsey value is returned, no stylesheet will be used and the “raw” XML of the sitemap will be displayed.
Parameters
$sitemap_urlstring-
Full URL for the sitemaps XSL file.
Source
return apply_filters( 'wp_sitemaps_stylesheet_url', $sitemap_url );
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |