When a site running WordPress loads there’s quite a lot of code in the <head> that some would argue is useless information. The most publicised of these is the WordPress Generator version information which lists that you are using WordPress and the version number.
In the <head> you will find:
<meta name="generator" content="WordPress 3.0.1" />
This code is generated when a theme includes the WordPress hook wp_head() within the <head> section of a template file (usually the header.php template file).
The problem with this is broadcasting the version number of WordPress is a potential security issue, especially if you tend not to update WordPress on a regular basis. Basically as a version of a particular software program (like WordPress ages) hackers are more likely to discover serious security flaws in the code of older versions (no software is 100% secure). When a version of WordPress is found to have a security issue hackers will scan the Internet for websites running that version of WordPress and if your site broadcasts the WordPress version number and you haven’t updated WordPress quickly enough, you may find your site is hacked and ruined!!!
When I first discovered this I tried removing wp_head() from a theme, but the wp_head() hook is important for other reasons, so you can’t just remove it, you have to selectively tell WordPress NOT to load that particular function when WordPress loads and that’s easily achieved at template level by adding this to your templates function.php file.
<?php remove_action('wp_head', 'wp_generator');?>
Try adding this to the very bottom of your functions.php file, if it doesn’t work try at the very top.
Cleaning the Head Code of WordPress
The wp_head hooks loads a bunch of functions, some of which can safely be removed on many WordPress sites.
Examples include: Really Simple Discovery (RSD) link, Windows Live Writer link and Post relational links.
remove_action wp_head Really Simple Discovery Links
This is the sort of code that’s displayed in the head:
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://domain.com/xmlrpc.php?rsd" />
This is the link used by XML-RPC clients, basically it’s used for integrating a WordPress site with other services like the Flickr API. If the site isn’t integrated with any other services, you can safely disable this code.
<?php remove_action('wp_head', 'rsd_link');?>
remove_action wp_head Windows Live Writer
This is the sort of code that’s displayed in the head:
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://domain.com/wp-includes/wlwmanifest.xml" />
If you don’t use Windows Live Writer to edit your WordPress site you should be able to safely disable this.
<?php remove_action('wp_head', 'wlwmanifest_link');?>
remove_action wp_head ShortLink
This is the sort of code that’s displayed in the head:
<link rel='shortlink' href='https://www.domain.com/?p=1' />
This is a link to the non permalinks version of a post. Can’t think of a reason why we’d want a link like that in the head?
Remove with:
<?php remove_action('wp_head', 'wp_shortlink_wp_head');?>
remove_action wp_head Index Relational Link
This is the sort of code that’s displayed in the head:
<link rel='index' title='Home Page' href='https://www.domain.com' />
It’s a link to your home page of the WordPress installation. Browsers like FireFox will preload these pages.
Remove with:
<?php remove_action('wp_head', 'index_rel_link');?>
remove_action wp_head Start Relational Link
This is the sort of code that’s displayed in the head:
<link rel='start' title='Your first Post' href='https://www.domain.com/first-post/' />
It’s a link to your first post. Browsers like FireFox will preload these pages. Seriously WordPress developers, what’s the likelihood the very first post someone made is going to be loaded by a visitor next, there’s probably not even a link to that page on most pages of a reasonable size blog?
Remove with:
<?php remove_action('wp_head', 'start_post_rel_link');?>
remove_action wp_head Previous and Next Relational Link
This is the sort of code that’s displayed in the head:
<link rel='prev' title='Previous Post' href='https://www.domain.com/previous-post/' />
<link rel='next' title='Next Post' href='https://www.domain.com/next-post/' />
It’s a link to your previous and next posts. Browsers like FireFox will preload these pages. Unless you have the previous and next links added to your theme it seems to be a waste of time loading these pages in advance. I could understand this concept with paged archive pages like Categories, but not on WordPress posts or pages.
Remove with:
<?php remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');?>
Talian 05 Theme Usage
Currently I block the wp_generator code in Talian 05 with no built in way to turn it back on, in the next update of Talian I’ll be adding all the above (and possibly more) with a tick box in the Talian admin menu for turning each on or off. I’ll probably set the wp_generator to off by default and the rest on by default, will then be up to Talian 05 theme users which items to disable/use.
There are other items loaded by the wp_head hook, but currently not sure which others are safe to remove.
These are not must have features in an SEO theme, but there is an argument if you can reduce the size of a pages code it will take less bandwidth and load faster.
David Law

2 responses to Removing WordPress Generator Version and Other Code From the Head
Thanks for these -- I’m always on the look out for ways to improve page load speeds. I’m finding a lot of gems on your site BTW -- I’m building my own theme and trying to make sure I max out the SEO.
Thanks! I was seeing init hooks being called twice and it took me forever to figure out why until I noticed the “next” link and tried commenting out the wp_head function in the header.
Leave a reply to Removing WordPress Generator Version and Other Code From the Head