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:
- Your important page content gets moved further up on the page
- You increase your content to code ratio
- 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:
1 |
<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:
1 |
remove_action ('wp_head', 'rsd_link'); |
Windows Live Writer Manifest Link
Example:
[html]
1 |
<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:
1 |
remove_action( 'wp_head', 'wlwmanifest_link'); |
WordPress Page/Post Shortlinks
Example:
1 |
<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:
1 |
remove_action( 'wp_head', 'wp_shortlink_wp_head'); |
WordPress Generator (with version information)
Example:
1 |
<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:
1 |
remove_action('wp_head', 'wp_generator'); |
Enjoy your slightly cleaner WordPress site header! You will sleep better at night knowing that those unnecessary lines are not bloating up your source code.
Great tips, thank you.
thax a lot ! : )
Brilliant stuff. Thanks mate, great to get rid of the superfluous stuff.
Thanks so much for the demos. So much easier than just flailing around and guessing!
was searching for how to remove wordpress generator and i landed on the exact place i suppose thanks Brandan Hoover keep up the great work 🙂
The part about removing shortlinks doesn’t work anymore. For whatever reason this is information wordpress absolutely wants to appear and it’s been added to multiple core files.
The shortlinks removal works just fine.
I have seen these removal options in Yoast Seo plugin. Does this really help to load the blog faster? And is there any side effect on SEO for this?
Many thanks – cleaned up my code
Thank you very much. All codes are working fine on my blog…
There are many more unnecessary things in the header. I remove everything with this plugin: https://wordpress.org/plugins/remove-wp-overhead/
Great tips – thanks for sharing!!
Great code worked for my site. thank you for sharing.
Thanks, I hope this still works after all these years. 🙂
Thanks very much. very much appreciated
Thanks very much thats a great help
Great code, worked straight away. Thanks very much for your help