Using WordPress ‘bloginfo_rss’ PHP filter

The bloginfo_rss WordPress PHP filter allows you to modify the bloginfo for display in RSS feeds.

Usage

add_filter('bloginfo_rss', 'your_custom_function', 10, 2);
function your_custom_function($rss_container, $show) {
    // your custom code here
    return $rss_container;
}

Parameters

  • $rss_container (string) – RSS container for the blog information.
  • $show (string) – The type of blog information to retrieve.

More information

See WordPress Developer Resources: bloginfo_rss

Examples

Modify the blog title in RSS feeds

Change the blog title to “My Custom Blog Title” in RSS feeds:

add_filter('bloginfo_rss', 'change_blog_title_rss', 10, 2);
function change_blog_title_rss($rss_container, $show) {
    if ($show == 'name') {
        $rss_container = 'My Custom Blog Title';
    }
    return $rss_container;
}

Append a copyright notice to the blog description in RSS feeds:

add_filter('bloginfo_rss', 'add_copyright_notice_rss', 10, 2);
function add_copyright_notice_rss($rss_container, $show) {
if ($show == 'description') {
$rss_container .= ' - Copyright ' . date("Y") . ' All Rights Reserved';
}
return $rss_container;
}

Change the blog language in RSS feeds


Set the blog language to “en-US” in RSS feeds:


add_filter('bloginfo_rss', 'change_blog_language_rss', 10, 2);
function change_blog_language_rss($rss_container, $show) {
    if ($show == 'language') {
        $rss_container = 'en-US';
    }
    return $rss_container;
}

Add a custom author name in RSS feeds


Add a custom author name to the blog in RSS feeds:


add_filter('bloginfo_rss', 'add_custom_author_rss', 10, 2);
function add_custom_author_rss($rss_container, $show) {
    if ($show == 'author') {
        $rss_container = 'John Doe';
    }
    return $rss_container;
}

Remove the blog tagline in RSS feeds


Remove the blog tagline from RSS feeds:


add_filter('bloginfo_rss', 'remove_blog_tagline_rss', 10, 2);
function remove_blog_tagline_rss($rss_container, $show) {
    if ($show == 'description') {
        $rss_container = '';
    }
    return $rss_container;
}