the_generator
云策文档标注
概述
the_generator 是一个 WordPress 过滤器,用于修改 XHTML 生成器标签的输出,适用于显示场景。它允许开发者自定义生成器内容,支持多种类型如 HTML、RSS 等。
关键要点
- 过滤器名称:the_generator,用于过滤生成器标签的输出。
- 参数:$generator_type(生成器输出字符串)和 $type(生成器类型,如 'html'、'rss2' 等)。
- 应用方式:通过 apply_filters 调用,结合 get_the_generator 函数生成输出。
- 相关函数:the_generator() 用于显示生成器 XML 或评论,位于 wp-includes/general-template.php。
- 版本历史:自 WordPress 2.5.0 版本引入。
原文内容
Filters the output of the XHTML generator tag, for display.
Parameters
$generator_typestring-
The generator output.
$typestring-
The type of generator to output. Accepts
'html','xhtml','atom','rss2','rdf','comment','export'.
Source
echo apply_filters( 'the_generator', get_the_generator( $type ), $type ) . "n";
Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |