WordPress Disabled RSS Feed

Normally if you build a blog then you need this RSS Feed but what if you want to build like a company profile website. The code below is going to disabled RSS Feed :

edit functions.php at active theme’s folder and add the code below :


/* Remove Unnecessary Code From Your WordPress Blog Header */
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'feed_links', 2 );

/* DISABLE WP RSS FEED */
function site_disable_feed() {
	wp_die( __( 'Sorry RSS Feed currently disabled, please visit the homepage' ) );
}
add_action('do_feed', 'site_disable_feed', 1);
add_action('do_feed_rdf', 'site_disable_feed', 1);
add_action('do_feed_rss', 'site_disable_feed', 1);
add_action('do_feed_rss2', 'site_disable_feed', 1);
add_action('do_feed_atom', 'site_disable_feed', 1);
add_action('do_feed_rss2_comments', 'site_disable_feed', 1);
add_action('do_feed_atom_comments', 'site_disable_feed', 1);

Leave a Reply

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