钩子文档

get_the_generator_{$type}

💡 云策文档标注

概述

本文档介绍了 WordPress 中的 get_the_generator_{$type} 过滤器钩子,用于修改特定生成器类型的 HTML 输出。该钩子是动态的,$type 参数指定生成器类型,如 HTML、RSS2 等。

关键要点

  • get_the_generator_{$type} 是一个过滤器钩子,用于过滤检索到的生成器类型的 HTML 标记。
  • 钩子名称是动态的,$type 部分指代生成器类型,例如 get_the_generator_atom、get_the_generator_rss2 等。
  • 参数包括 $genstring(HTML 标记输出)和 $type(生成器类型字符串,如 'html'、'rss2')。
  • 相关函数包括 get_the_generator(),用于创建 RSS、ATOM 等的生成器 XML 或注释。
  • 该钩子自 WordPress 2.5.0 版本引入。

📄 原文内容

Filters the HTML for the retrieved generator type.

Description

The dynamic portion of the hook name, $type, refers to the generator type.

Possible hook names include:

  • get_the_generator_atom
  • get_the_generator_comment
  • get_the_generator_export
  • get_the_generator_html
  • get_the_generator_rdf
  • get_the_generator_rss2
  • get_the_generator_xhtml

Parameters

$genstring
The HTML markup output to wp_head() .
$typestring
The type of generator. Accepts 'html', 'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'.

Source

return apply_filters( "get_the_generator_{$type}", $gen, $type );

Changelog

Version Description
2.5.0 Introduced.