How to disable RSS feed in WordPress

Simple way to disable RSS Feeds is to add below to functions.php file of your child theme.

/* Function and hooks for disabling RSS feed */
function disable_rss_feed() {
	wp_die( __( 'No feed available,
	please visit the <a href="'. esc_url( home_url( '/' ) ) .'">homepage</a>!' ) );
}

add_action('do_feed', 'disable_rss_feed', 1);
add_action('do_feed_rdf', 'disable_rss_feed', 1);
add_action('do_feed_rss', 'disable_rss_feed', 1);
add_action('do_feed_rss2', 'disable_rss_feed', 1);
add_action('do_feed_atom', 'disable_rss_feed', 1);
add_action('do_feed_rss2_comments', 'disable_rss_feed', 1);
add_action('do_feed_atom_comments', 'disable_rss_feed', 1);
remove_action( 'wp_head', 'feed_links_extra', 3 ); 
remove_action( 'wp_head', 'feed_links', 2 ); 
remove_action( 'wp_head', 'rsd_link' ); 
remove_action( 'wp_head', 'wlwmanifest_link' ); 
remove_action( 'wp_head', 'index_rel_link' ); 
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); 
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); 
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); 
remove_action( 'wp_head', 'wp_generator' );
0 Points