Skip to content

Instantly share code, notes, and snippets.

@rickrduncan
Last active November 6, 2015 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickrduncan/b7f95d0c40a763c8081c to your computer and use it in GitHub Desktop.
Save rickrduncan/b7f95d0c40a763c8081c to your computer and use it in GitHub Desktop.
Small script to place in child theme functions.php file to disable RSS feed.
<?php
//* Do NOT include the opening php tag
//* BEGIN: Disable WordPress RSS Feed
function b3m_disable_rss_feed() {
wp_die( __( 'Our RSS feed is disabled. Please <a href="'. get_bloginfo('url') .'">visit our homepage</a>.' ) );
}
add_action( 'do_feed', 'b3m_disable_rss_feed', 1 );
add_action( 'do_feed_atom', 'b3m_disable_rss_feed', 1 );
add_action( 'do_feed_rdf', 'b3m_disable_rss_feed', 1 );
add_action( 'do_feed_rss', 'b3m_disable_rss_feed', 1 );
add_action( 'do_feed_rss2', 'b3m_disable_rss_feed', 1 );
//* END: Disable WordPress RSS Feed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment