get_the_title_rss()WP 2.0.0

Retrieve the current post title for the feed.

Hooks from the function

Return

String. Current post title.

Usage

get_the_title_rss( $post );
$post(int|WP_Post)
Post ID or WP_Post object.
Default: global $post

Examples

0

#1 Post title in RSS feed format

<item>
	<title><?php echo get_the_title_rss(); ?></title>

OR you can do it using the_title_rss():

<item>
	<title><?php the_title_rss(); ?></title>
0

#2 Using the_title_rss()

Same as example #1, only here we use the_title_rss():

<item>
	<title><?php the_title_rss(); ?></title>

Changelog

Since 2.0.0 Introduced.
Since 6.6.0 Added the $post parameter.

get_the_title_rss() code WP 6.8

function get_the_title_rss( $post = 0 ) {
	$title = get_the_title( $post );

	/**
	 * Filters the post title for use in a feed.
	 *
	 * @since 1.2.0
	 *
	 * @param string $title The current post title.
	 */
	return apply_filters( 'the_title_rss', $title );
}