If you maintain a site based on Wordpress, you may have noticed that the head section of your pages can get out of control rather quickly, especially if you have a lot of plugins installed. It is fairly easy to eliminate some of this unnecessary bloat.

Look in your theme directory (/wp-content/themes/themedir) and you should see a functions.php file. If not, you’ll need to create the file. Here is an example of what I added to help clean up my head section:

  1. <?php
  2.  remove_action('wp_head', 'rsd_link');
  3.  remove_action('wp_head', 'wlwmanifest_link');
  4.  remove_action('wp_head', 'wp_generator');
  5.  remove_action('wp_footer', array('adsensem','footer'));
  6. ?>

Here is what that code accomplishes:

  • The first line removes the Really Simple Discovery link.
  • The second line removes the Windows Live Writer link.
  • The third line removes the Wordpress version.
  • And since I use the Adsense Manager plugin, I wanted to get rid of the comment that gets added to the footer. The last line accomplishes that.

Of course, you could hunt down the source of the lines that get added to the head section in the Wordpress source code, but any changes you make to those files would be overwritten if you upgrade your Wordpess install. By making the changes to the functions.php file in your theme directory instead, you will be able to upgrade without fear of overwriting your changes.