WordPress 3 introduced a new feature – shortlink. Shortlink is a shorten version of a web page’s URL. This is where an SEO-friendly URL (that might have keywords in), is shorted to just a few characters after the domain name in URL. You’ve probably seen these all over twitter, using it’s own t.co domain, and in many other places.
You can read more about shortlinks over on the microformats site: http://microformats.org/wiki/rel-shortlink
In order to support redirecting of shortlinks to their post, WordPress adds a line of HTML code as a link tag in the header, which looks like this:
<link rel='shortlink' href='http://www.douglasradburn.co.uk/?p=1487' />
If you don’t specify your own shortlink URL (which you can do using various plugins, the default shortlink will be ?p=ID
, where ID represents the ID number of the post or page in WordPress.
For anyone not using the shortlink functionality, this bulks out the header, and isn’t needed. For those going for speed, or trying to make their WordPress site look less like a WordPress site, then we can remove the header link by simply adding a quick plugin:
1 2 3 4 5 6 7 8 9 10 11 12 |
< ?php /* Plugin Name: Shortlink Removal Plugin URI: http://www.douglasradburn.co.uk/ Description: Remove shortlink hook Version: 1.0 Author: Douglas Radburn Author URI: http://www.douglasradburn.co.uk */ remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0); ?> |
Save this file with it’s own unique name – perhaps shortlink-remover.php
– and add it to your plugins folder.
Alternatively, if you’d like to add this to your theme, you can add the line from the bottom of this file to your functions.php file included within your theme directory:
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
There you have it – no more shortlink link tag in your header.
Image Credit: IronRodArt - Royce Bair ("Star Shooter")
Comment or tweet @douglasradburn