(+84) 463.28.7979

How to Disable RSS Feeds in WordPress

WordPress is one of the best Content Management System (CMS) available. There will be times that you will create a static website and does not want to implement RSS Feeds. But that feature is automatically included in WordPress and in order to turn it off, you would have to edit core files. But in this article we will show you how you can disable RSS Feeds without editing the core file by simply creating a function in WordPress.

Open your functions.php located within your themes folder and add the following code:

function fb_disable_feed() {
wp_die( __(‘No feed available,please visit our <a href=”‘. get_bloginfo(‘url’) .’”>homepage</a>!’) );

add_action(‘do_feed’, ‘fb_disable_feed’, 1);
add_action(‘do_feed_rdf’, ‘fb_disable_feed’, 1);
add_action(‘do_feed_rss’, ‘fb_disable_feed’, 1);
add_action(‘do_feed_rss2′, ‘fb_disable_feed’, 1);
add_action(‘do_feed_atom’, ‘fb_disable_feed’, 1);

Once you add this code, anytime someone tries to reach your feeds, they will see this message: “No feed available, please visit our homepage.” You can change the message to fit your needs.

Source: Frank from WPEngineer

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>