the_content_feedfilter-hookWP 2.9.0

Filters the full description content output in a feed. The feed type is passed in the second parameter.

The post content is retrieved from the database and filtered by the the_content filter. Then the_content_feed fires immediately before the post content is sent to the RSS handler.

Usage

add_filter( 'the_content_feed', 'filter_function_name_11', 10, 2 );
function filter_function_name_11( $content, $feed_type ) {
	// Filter...

	return $content;
}

Parameters

$content(string)
The full description content to process.
$feed_type(string)
The feed type. It can be rss2 | atom | rss | rdf.

Examples

#1 Add copyright information to the end of post content in a feed

The example demonstrates how to add a link to the source site at the end of the feed content:

function add_text_to_the_feed_end( $content ){
	$content .= '
	<p>
		Source: <a href="'. get_bloginfo('url') .'">'. get_bloginfo('name') .'</a>.
	</p>
	';

	return $content;
}
add_filter( 'the_excerpt_rss', 'add_text_to_the_feed_end' );

To add such a link to the feed's short description, use the the_excerpt_rss filter hook.

Changelog

Since 2.9.0 Introduced.

Where the hook is called

get_the_content_feed()
the_content_feed
wp-includes/feed.php 208
return apply_filters( 'the_content_feed', $content, $feed_type );

Where the hook is used in WordPress

wp-includes/default-filters.php 261
add_filter( 'the_content_feed', 'wp_staticize_emoji' );
wp-includes/default-filters.php 262
add_filter( 'the_content_feed', '_oembed_filter_feed_content' );