函数文档

get_bloginfo_rss()

💡 云策文档标注

概述

get_bloginfo_rss() 函数用于在 RSS 源中检索站点信息,它会调用 get_bloginfo() 并自动去除标签和转换字符,确保输出适合 RSS 格式。

关键要点

  • 基于 get_bloginfo() 函数,支持相同的参数 $show 来指定要检索的站点信息类型
  • 自动应用 strip_tags() 和 convert_chars() 处理,确保输出内容在 RSS 源中安全显示
  • 提供 'get_bloginfo_rss' 过滤器,允许开发者自定义输出内容
  • 返回字符串类型的处理后的站点信息

代码示例

$rss2_url = get_bloginfo_rss( 'rss2_url' );

📄 原文内容

Retrieves RSS container for the bloginfo function.

Description

You can retrieve anything that you can using the get_bloginfo() function.
Everything will be stripped of tags and characters converted, when the values are retrieved for use in the feeds.

See also

Parameters

$showstringrequired
See get_bloginfo() for possible values.

More Arguments from get_bloginfo( … $show )

Site info to retrieve. Default empty (site name).

Return

string

Source

function get_bloginfo_rss( $show = '' ) {
	$info = strip_tags( get_bloginfo( $show ) );
	/**
	 * Filters the bloginfo for use in RSS feeds.
	 *
	 * @since 2.2.0
	 *
	 * @see convert_chars()
	 * @see get_bloginfo()
	 *
	 * @param string $info Converted string value of the blog information.
	 * @param string $show The type of blog information to retrieve.
	 */
	return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show );
}

Hooks

apply_filters( ‘get_bloginfo_rss’, string $info, string $show )

Filters the bloginfo for use in RSS feeds.

Changelog

Version Description
1.5.1 Introduced.

User Contributed Notes