Want to know what WordPress Theme a site is using? Check Out Now!

How to Disable RSS Feeds in WordPress?

RSS feeds allow your website visitors to subscribe to your blog posts. But not all sites require RSS feeds.

You can disable the RSS feeds in WordPress if you own a static website or don’t have blog posts. WordPress doesn’t offer an option to turn off the RSS feeds.

You can use the below code to remove the RSS feeds of your WordPress website.

/**
 * Disable RSS feeds in WordPress
 */
function unmaskwp_disable_feeds()
{
    wp_die(__('No feed available, please visit the <a href="' . esc_url(home_url('/')) . '">homepage</a>!'));
}

add_action('do_feed', 'unmaskwp_disable_feeds', 1);
add_action('do_feed_rdf', 'unmaskwp_disable_feeds', 1);
add_action('do_feed_rss', 'unmaskwp_disable_feeds', 1);
add_action('do_feed_rss2', 'unmaskwp_disable_feeds', 1);
add_action('do_feed_atom', 'unmaskwp_disable_feeds', 1);
add_action('do_feed_rss2_comments', 'unmaskwp_disable_feeds', 1);
add_action('do_feed_atom_comments', 'unmaskwp_disable_feeds', 1);

Leave a Reply

Your email address will not be published. Required fields are marked *