get_the_title_rss()
Gets the post title. Used when displaying the title in the RSS feed. Used in The Loop.
The function is used when creating the XML document for the RSS feed. It is needed so that plugins can change the post title in the RSS feed via the filter the_title_rss.
Use the_title_rss(), to display the title on the screen, rather than getting a string for further processing.
Hooks from the function
Returns
String. String, the post title.
Usage
echo get_the_title_rss();
Examples
#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>
#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() get the title rss code WP 7.0
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 );
}