How to Disable RSS Feeds, Disabled unwanted WordPress Feeds

Does your website have only static content? Don’t want the RSS Feeds to be created and published? With this code, you can disable all types of feeds.

Introduction to Feeds

A feed is a function of special software that allows feedreaders to access a site, automatically looking for new content and then posting the information about new content and updates to another site. This provides a way for users to keep up with the latest and hottest information posted on different blogging sites.
There are several different kinds of feeds, read by different feedreaders. Some feeds include RSS (alternately defined as “Rich Site Summary” or “Really Simple Syndication”), Atom or RDF files.”

Source : https://codex.wordpress.org/WordPress_Feeds

How to Disable RSS Feeds, Disabled unwanted WordPress Feeds – please add the code snippet below on your WordPress theme’s functions.php file.

/**
 *
 * Cookie notification footer
 */
if ( ! function_exists( 'ns_disable_feed' ) ) {
function ns_disable_feed() {
   wp_die( __( 'No feed available, Please visit our <a href="http://www.yoursite.com">homepage</a> to see our site!' ) );
}
}

add_action( 'do_feed' , 'ns_disable_feed', 1 );
add_action( 'do_feed_rdf' , 'ns_disable_feed', 1 );
add_action( 'do_feed_rss' , 'ns_disable_feed', 1 );
add_action( 'do_feed_rss2' , 'ns_disable_feed', 1 );
add_action( 'do_feed_atom' , 'ns_disable_feed', 1 );

Thank you for seeing my tutorial and feel free to share and comment :). Do you have a code snippet and you want to see it published on my site? I will be more than happy to do it please send me a message (here)

ABOUT AUTHOR

Nuno

I am a Freelance Web Developer and WordPress Expert based in London with a wealth of website development and support experience. I am great at problem solving and developing quick solutions.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • LET'S TALK!

    Fill in the form below to make an enquiry or find my contact details on my contact page.