/** * Display a custom message instead of the RSS Feeds. * * @return void */ function wpcode_snippet_disable_feed() { wp_die( sprintf( // Translators: Placeholders for the homepage link. esc_html__( 'No feed available' ), ' ', '' ) ); } // Replace all feeds with the message above. add_action( 'do_feed_rdf', 'wpcode_snippet_disable_feed', 1 ); add_action( 'do_feed_rss', 'wpcode_snippet_disable_feed', 1 ); add_action( 'do_feed_rss2', 'wpcode_snippet_disable_feed', 1 ); add_action( 'do_feed_atom', 'wpcode_snippet_disable_feed', 1 ); add_action( 'do_feed_rss2_comments', 'wpcode_snippet_disable_feed', 1 ); add_action( 'do_feed_atom_comments', 'wpcode_snippet_disable_feed', 1 ); // Remove links to feed from the header. remove_action( 'wp_head', 'feed_links_extra', 3 ); remove_action( 'wp_head', 'feed_links', 2 );
Skip to content