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]:

<?php

// Remove unnecessary stuff from HEAD
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed

?>

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:

<?php

// Add link to RSS feed to HEAD
function restore_feed_link() {
echo '<link rel="alternate" type="application/rss+xml" title="Chainsaw on a Tire Swing" href="http://www.chainsawonatireswing.com/feed/" />' . "\n";
}
add_action('wp_head', 'restore_feed_link');

?>

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.

<?php

// Remove unnecessary stuff from HEAD
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // start link
remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 ); // Display relational links for the posts adjacent to the current post
remove_action( 'wp_head', 'wp_generator' ); // Display the XHTML generator that is generated on the wp_head hook, WP version

?>