Below is the code to disable RSS feeds in WordPress.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Disable RSS feeds in WordPress | |
add_action('do_feed', 'customprefix_disable_rss_feeds', 1); | |
add_action('do_feed_rdf', 'customprefix_disable_rss_feeds', 1); | |
add_action('do_feed_rss', 'customprefix_disable_rss_feeds', 1); | |
add_action('do_feed_rss2', 'customprefix_disable_rss_feeds', 1); | |
add_action('do_feed_atom', 'customprefix_disable_rss_feeds', 1); | |
add_action('do_feed_rss2_comments', 'customprefix_disable_rss_feeds', 1); | |
add_action('do_feed_atom_comments', 'customprefix_disable_rss_feeds', 1); | |
function customprefix_disable_rss_feeds() { | |
wp_die(__('Sorry, but syndication has been disabled on this site. To be notified of a new post, please follow us on <a href="https://twitter.com/account-name/" target="_blank" rel="nofollow">Twitter</a>.<br/><br/>Back to <a href="' . get_bloginfo('url') . '">homepage</a>.')); | |
} |
Alternatively, you can download, install and set up Disable Feeds from the WordPress Plugin Repository.