How to remove RSS feeds in WordPress

How can I remove all RSS feeds in my WordPress website?

Add this code to your functions file:

[php]
<?php
// Remove RSS feeds
function weext_disable_feed() {
wp_die( __( ‘No feed available, please visit the homepage!’ ) );
}
add_action(‘do_feed’, ‘weext_disable_feed’, 1);
add_action(‘do_feed_rdf’, ‘weext_disable_feed’, 1);
add_action(‘do_feed_rss’, ‘weext_disable_feed’, 1);
add_action(‘do_feed_rss2’, ‘weext_disable_feed’, 1);
add_action(‘do_feed_atom’, ‘weext_disable_feed’, 1);
add_action(‘do_feed_rss2_comments’, ‘weext_disable_feed’, 1);
add_action(‘do_feed_atom_comments’, ‘weext_disable_feed’, 1);
remove_action( ‘wp_head’, ‘feed_links_extra’, 3 );
remove_action( ‘wp_head’, ‘feed_links’, 2 );
?>
[/php]

Submit a Comment

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