How to Customize Posts in the WordPress RSS Feed

Last Updated: Jun 7, 2022 | WordPress Tips

Many SEO plugins will offer a way to essentially brand your RSS feed to your website. However, not everyone wants to use an SEO plugin. This article will show you what to do to customize posts in the WordPress RSS feed.

In order to get these snippets to work, you will need to add them to your functions.php file.

Add Website Name to RSS Post Title

Here’s the snippet to add your website name to your RSS post title similarly to how it appears in the browser. If you copy this snippet, be sure to change WEBSITENAME to your website’s actual name.

//Add Website Name to RSS post titles
function websitejolt_titlerss($content) {
$content = $content.' | WEBSITENAME';
return $content;
add_filter('the_title_rss', 'websitejolt_titlerss');

Add Text to All Posts in RSS

Here’s the snippet to add essentially a website credit to your RSS entries. It will look like this:

The post POSTTITLE appeared first on WEBSITENAME.

The RSS entry will automatically add the post name, post link, website URL, and website name. There’s nothing to change here unless you do not like the sentence.

//Add text to all Posts in RSS
function websitejolt_postrss($content) {
$content .= '<p>The post <a rel="nofollow" href="'.get_permalink().'">'.get_the_title().'</a> appeared first on <a rel="nofollow" href="'.get_bloginfo('url').'">'.get_bloginfo('name').'</a>.</p>';
return $content;
add_filter('the_excerpt_rss', 'websitejolt_postrss');
add_filter('the_content', 'websitejolt_postrss');

Add Featured Image to Post Feed

Here’s the snippet to add a featured image to an RSS entry. Even though this adds additional resources to load, it is recommended to do to make your posts in an RSS feed reader look nice.

This automatically pulls your post thumbnail per post. There’s nothing further to customize here.

//Add Featured Image to post feed
function rss_post_thumbnail($content) {
global $post;
if(has_post_thumbnail($post->ID)) {
$content = '<p>' . get_the_post_thumbnail($post->ID) .
'</p>' . get_the_content();
return $content;
add_filter('the_excerpt_rss', 'rss_post_thumbnail');
add_filter('the_content_feed', 'rss_post_thumbnail');

Add Delay to Feed

Here’s the snippet to add a delay to entries in your RSS feed. This can be useful to ensure your content will be indexed before the content scrappers.

This automatically adds a delay per post based on date and time configuration. The sample below is based on a month’s delay. If you wish to change the delay, you can change $wait and/or $device.

//Add delay to feed
function publish_later_on_feed($where) {
    global $wpdb;
    if ( is_feed() ) {
        // timestamp in WP-format
        $now = gmdate('Y-m-d H:i:s');
        // value for wait; + device
        $wait = '1'; // integer
        $device = 'MONTH'; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR
        // add SQL-sytax to default $where
        $where .= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait ";
    return $where;
add_filter('posts_where', 'publish_later_on_feed');


Those are the RSS functions that have proven to be useful for us in the past.



Related Content