Remove Unnecessary Code From Your WordPress Blog Header

There are a few links that are included in your WordPress blog header that can be removed.

Removing unnecessary code from your page header is a good idea for the following reasons:

  1. Your important page content gets moved further up on the page
  2. You increase your content to code ratio
  3. You pages will load faster. Visitors will not notice, but search engine spiders will.

Here are a few lines that you probably will not miss:

Weblog Client Link
Example:

<link rel="EditURI" type="application/rsd xml" title="RSD" href="https://bhoover.com/wp/xmlrpc.php?rsd

Are you editing your WordPress blog using your browser? Then you are not using a blog client and this link can probably be removed. This link is also used by a few 3rd party sites/programs that use the XML-RPC request formats. One example is the Flickr API. So if you start having trouble with a 3rd party service that updates your blog, add this back in. Otherwise, remove it.

To remove the EditURI/RSD link from your header, open functions.php (in your theme folder) and add this line at the bottom of the page:

remove_action ('wp_head', 'rsd_link');

Windows Live Writer Manifest Link
Example:

<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="https://bhoover.com/wp/wp-includes/wlwmanifest.xml">

If you don’t know what Windows Live Writer is (it’s another blog editing client), then remove this link.
To remove the wlwmanifest link from your header, open functions.php and add this line at the bottom of the page:

remove_action( 'wp_head', 'wlwmanifest_link');

WordPress Page/Post Shortlinks
Example:

<link rel='shortlink' href="https://bhoover.com/?p=42">

URL shortening is sometimes useful, but this automatic ugly url in your header is useless. There is no reason to keep this. None.
To remove the shortlink from your header, open functions.php and add this line at the bottom of the page:

remove_action( 'wp_head', 'wp_shortlink_wp_head');

WordPress Generator (with version information)
Example:

<meta name="generator" content="WordPress 3.4.2">

This announces that you are running WordPress and what version you are using. It serves no purpose.
You should always be running the latest version of WordPress. If you are living life on the edge and are a few releases behind, why advertise how vulnerable you are?
To remove WordPress Generator from your header, open functions.php and add this line at the bottom of the page:

remove_action('wp_head', 'wp_generator');

Other examples

remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'feed_links_extra', 3);
remove_action('wp_head', 'start_post_rel_link', 10, 0);
remove_action('wp_head', 'parent_post_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link', 10, 0);
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head, 10, 0');
/*Easy Digital Downloads plugin*/
remove_action('wp_head', 'edd_version_in_header');