I want to completely remove feeds from WordPress. I am using this little function from http://wpengineer.com/287/disable-wordpress-feed/
/**
* disable feed
*/
function fb_disable_feed() {
wp_die( __('No feed available,please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
}
add_action('do_feed', 'fb_disable_feed', 1);
add_action('do_feed_rdf', 'fb_disable_feed', 1);
add_action('do_feed_rss', 'fb_disable_feed', 1);
add_action('do_feed_rss2', 'fb_disable_feed', 1);
add_action('do_feed_atom', 'fb_disable_feed', 1);
Still there is tons of transient options.. like _transient_feed_mod
or _transient_timeout_feed_mod
How can i completely remove feeds from WordPress?
First step: remove the feed links from the section of your site.
Next up, let’s remove the feed endpoints from WP. Hook into
init
, globalize$wp_rewrite
then set the feeds to an empty array. This effectively stops WordPress from adding feed rewrites. It’s also super hackish and will probably break at some point in the future.But, if it breaks, that’s okay, because we’ll redirect feeds to the home page.
And the last step: an activation hook to set our rewrite feeds to an empty array and flush the rewrite rules.
All that as a plugin.
The code you posted will do exactly what it says it will – prevent anyone from accessing your site via an RSS feed.
These transient options have absolutely nothing to do with your site feed. The WordPress dashboard consumes several feeds by default and displays them in boxes on the admin dashboard. Plugins you install might add their own feeds, either for news displays or for updates.
These transient values are used by WordPress to determine when these consumed feeds have been updated.
The code you’ve posted already has …
This should do it
Better yet, if you have at least PHP 5.3 you can use a shorter version:
Removing rewrites, on the other hand, would take a lot longer, so unless you’re totally nuts about performance you can leave them there.