Created
June 28, 2013 20:04
-
-
Save vdite/5887650 to your computer and use it in GitHub Desktop.
Completely Remove RSS Feeds in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add this to yout functions.php file | |
// you may just want to kill all your RSS Feeds, wordpress does provide | |
remove_action('do_feed', 'disable_all_feeds', 1); | |
remove_action('do_feed_rdf', 'disable_all_feeds', 1); | |
remove_action('do_feed_rss', 'disable_all_feeds', 1); | |
remove_action('do_feed_rss2', 'disable_all_feeds', 1); | |
remove_action('do_feed_atom', 'disable_all_feeds', 1); | |
// or you wanna kill them, but tell the readers why. | |
// http://www.doitwithwp.com/completely-remove-rss-feeds-in-wordpress/ | |
function disable_all_feeds() { | |
wp_die( __('Sorry, our content is not available by RSS. Please head over to <a href="'. get_bloginfo('url') .'">our site</a>') ); | |
} | |
add_action('do_feed', 'disable_all_feeds', 1); | |
add_action('do_feed_rdf', 'disable_all_feeds', 1); | |
add_action('do_feed_rss', 'disable_all_feeds', 1); | |
add_action('do_feed_rss2', 'disable_all_feeds', 1); | |
add_action('do_feed_atom', 'disable_all_feeds', 1); | |
// do not forget to cleanup the head links | |
remove_action( 'wp_head', 'feed_links_extra', 3 ); | |
remove_action( 'wp_head', 'feed_links', 2 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// add this to yout functions.php file
Where?
I certainly appreciate your sharing with everyone, but not everyone is a seasoned veteran PHP programmer, intimately familiar with the inner workings of Wordpress. And I'm lucky I have access to my systems shell and know vim; if that hadn't been true, the error in attempt #1 would have rendered my site useless until I could get help.