Function and usage of bloginfo_rss() in wordpress


Answers ( 1 )


    The bloginfo_rss() function in WordPress is a specialized version of the bloginfo() function, tailored for use in RSS feeds. Here's a detailed explanation:


    • Name: bloginfo_rss()
    • Purpose: Displays RSS container for the bloginfo() function.


    • This function is used within WordPress to retrieve various pieces of information about the site, similar to what get_bloginfo() does, but with a focus on RSS feeds.
    • When you use bloginfo_rss(), the output is specifically formatted for use in RSS feeds. This means that all HTML tags are stripped out and special characters are converted to their corresponding HTML entities. This is crucial for ensuring that the feed remains valid XML, which is the standard format for RSS feeds.


    • $show (string, optional): This parameter specifies what site information you want to retrieve and display.
    • Default value: An empty string (''), which typically returns the site name.
    • Possible values: The $show parameter can accept a variety of values, each corresponding to different types of site information. These values are consistent with those accepted by get_bloginfo(). For example, you can use values like 'name' for the site's name, 'description' for the site's description, 'url' for the site URL, etc.

    Usage Example:

    Here's a sample usage of bloginfo_rss() in a WordPress theme or plugin:

    <?php bloginfo_rss('name'); ?> - <?php bloginfo_rss('description'); ?>

    This code would output the site's name and description in a format suitable for RSS feeds, with HTML tags stripped and characters converted appropriately.

    See Also:

    • get_bloginfo(): Refer to this function for a comprehensive list of possible values for the $show parameter. get_bloginfo() provides similar functionality but is used for general purposes, not specifically for RSS feeds.

    By using bloginfo_rss(), WordPress theme and plugin developers can ensure that their RSS feeds include the correct site information in a format that's compatible with RSS standards.

Leave an answer