Using WordPress ‘get_bloginfo_rss’ PHP filter

The get_bloginfo_rss WordPress PHP filter modifies the blog information for use in RSS feeds.

Usage

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

Parameters

  • $info (string) – The converted string value of the blog information.
  • $show (string) – The type of blog information to retrieve.

More information

See WordPress Developer Resources: get_bloginfo_rss

Examples

Remove HTML tags from blog description

Remove any HTML tags from the blog description in the RSS feed.

add_filter('get_bloginfo_rss', 'remove_html_tags_from_description', 10, 2);
function remove_html_tags_from_description($info, $show) {
    if ('description' === $show) {
        $info = strip_tags($info);
    }
    return $info;
}

Add custom prefix to blog name

Add a custom prefix to the blog name in the RSS feed.

add_filter('get_bloginfo_rss', 'add_custom_prefix_to_blog_name', 10, 2);
function add_custom_prefix_to_blog_name($info, $show) {
    if ('name' === $show) {
        $info = 'My Custom Prefix - ' . $info;
    }
    return $info;
}

Replace specific words in blog description

Replace specific words in the blog description for the RSS feed.

add_filter('get_bloginfo_rss', 'replace_specific_words_in_description', 10, 2);
function replace_specific_words_in_description($info, $show) {
    if ('description' === $show) {
        $info = str_replace('Old Word', 'New Word', $info);
    }
    return $info;
}

Make blog name uppercase

Change the blog name to uppercase in the RSS feed.

add_filter('get_bloginfo_rss', 'make_blog_name_uppercase', 10, 2);
function make_blog_name_uppercase($info, $show) {
    if ('name' === $show) {
        $info = strtoupper($info);
    }
    return $info;
}

Add a copyright notice to the blog description in the RSS feed.

add_filter('get_bloginfo_rss', 'append_copyright_notice_to_description', 10, 2);
function append_copyright_notice_to_description($info, $show) {
    if ('description' === $show) {
        $info .= ' © ' . date('Y') . ' Your Company Name. All rights reserved.';
    }
    return $info;
}