How to remove the RSS feed for comments in the Twenty Eleven theme for WordPress
It took me a while to figure this one out, & I couldn’t find a clear answer using Google, so I thought others might find this useful.
I’m not using comments here on Chainsaw on a Tire Swing, but WordPress goes ahead and inserts a link to the comments RSS feed in the HTML of every webpage. This is silly—you’d think that the theme could recognize that I have commenting turned off, so it would therefore remove the comments RSS feed. But alas, it does not.
So here’s what I did. Note that I’m using a child theme of Twenty Eleven, so my instructions assume that. Still, my instructions should work just fine if you’re not using a child theme.
If you don’t already have a functions.php
file, create one in your theme directory. Place the following in functions.php
[^fun-with-functions-php]:
This removes the comments RSS feed, which you want, but it also removes the posts RSS feed, which you do not want (at least I sure didn’t want that!). So now you need to add this to your functions.php
file, after the previous code:
This adds a link to your site’s RSS feed for posts. Obviously, change the title
and href
in this code, or you’ll be pointing to this site’s RSS feed. I’ll take all the readers I can get, but that’s probably not what you want.
Oh, & you can actually remove a lot of things using this technique. Here’s the complete list. I just commented out the stuff I wanted to keep, but kept this whole code chunk for reference.