Disable WordPress Feed

A really good feature for many websites and already a standard on many blogs is the possibility to subscribe via feed for new posts.

But if you use WordPress for a specific purpose, for example as a CMS, it's possible that you really don't need that feature because it has no extra value for your users. Maybe because you only have static pages or you just don't want to spread your news this way.

For everybody who doesn't need the feed functionality in WordPress I show you in a little tutorial how to deactivate all formats of a feed in WordPress.
The easiest way, which I personally don't recommend, is to adjust your code in the core files. You can find the responsible code in wp-settings.php, in your root of WordPress.

require (ABSPATH . WPINC . '/feed.php');

With this method you have an easy way to deactivate, but you have to do it again when the next update for WordPress is knocking on your door. That can be a torture, especially when the automatic update is coming along with WordPress 2.7 - How core update in WordPress 2.7 works.

A little bit more time consuming method is to deactivate feeds via hook in your theme or a Plugin. You just have to copy the following lines and copy them into functions.php of your theme. If this file doesn't exist, just create it and WordPress will recognize it.
The feed is not deleted, but the user gets an info. In detail, the feed URL will still exist, but if the user put in the URL directly, he doesn't get any content but a text, which is been placed in the following code.

That's an easy way to disable feeds on your website.
I do adjustments like this also for my clients in the backend. I only show my clients what they really need to see. Functions, which he doesn't need for his use are hidden - easily possible with my Plugin Adminimize. More about Adminimize in a future post.

38 comments

Im a total noob with this, so Im kinda confused. Im using the Sharpfolio theme. Ive tried to paste the code into functions.php but I only get some weird error message. Am I supposed to paste this after the codes thats already there or before? What EXACTLY should I do? I really appreciate all the help I can get!
Thanks

I tried what you wrote, but it didnt work. probably me doing something wrong.
Then I tried something on my own and ended the code with instead. Now I cant login to my page anymore. I just get a white blank page. What do I do?!?!?!

Listen, I am using this to disable feeds, but I am hoping there is a way to only disable the MAIN Entries feed...

I'd still like to have feeds available for each category... please help if you can!

Thanks

- Michael

P.S. Basically... what I'm trying to do is use Feedburner to create a feed for just two of my categories, but I don't want to have both categories showing up in ONE rss feed... so I do need to disable the main feed.

This works fine for template-added RSS links which I'll be removing anyways and also if I copy and paste or type the feed address in the address bar. It doesn't seem to work for Firefox's auto-feed discovery in the address bar and at the top right of each page. When I click on either of those I'm taken directly to my feed in my feedreader with all posts showing. Is there any way around this?

thanks for the tip! It's pretty close to what I did, the difference was that I did a redirect to the homepage. Your solution is better because the visitor will get a feedback.

Just one issue to make it perfect: Any idea how to remove that rss-icon in the browser (adress bar) - this one indicates that a webpage has actually got a feed... It's just cosmetic, but the visitor could get confused by this.

Best regards and thanks, thanks, thanks for sharing all that great stuff.

You have to clear the line in your theme's header:
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
(just for the case the code above won't get formatted right: there should be a "link" tag with "href" = bloginfo('rss2_url') or sth similar.)

Instead of seeing a page or article, sometimes (quite often) I get the comments feed of another random article. It's completely random, I cannot see a rule for this bug.

It might be a server problem, but there should be a way to fix it in the application. A way should be to check if the link in the address bar contains /feed and only then to show a feed. How can one do that?

Is there a way to disable only some of the feeds? If WordPress is used as a CMS on a site that also contains a blog, then can all posts within the 'blog' still have their own feed, but any other posts used for the site itself be disabled?

Also, I needed to get rid of the RSS icon in the address bar for another site, and Basti's solution above didn't help as I didn't have the particular line of code in my header.php, but I found this solution from hollywoodgrind on the WordPress forum: http://wordpress.org/support/topic/remove-feed-from-wp_head

I updated functions.php with the disable RSS code and it works perfectly for the secure URL: https:// mysite.com/feed, however the non-secure URL mysite.com/feed still shows the RSS feeds in both IE8 and Firefox!

Any suggestions why RSS is blocked in HTTPS but not in HTTP are appreciated.