How To Disable and Remove the WordPress Shortlink

Document Sample
How To Disable and Remove the WordPress Shortlink Powered By Docstoc
					        How To Disable and Remove the
             WordPress Shortlink
We recently noticed an issue where Yahoo indexed several pages from one of our
WordPress sites using the WordPress shortlink, rather than the permalink. Here is
the method for resolving this issue.



For those who do not know what a shortlink looks like, it is a line of code that is
added to the head section of the HTML code for a WordPress post or page. It
looks like this:



WordPress shortlink



The WordPress shortlink is a version of a URL that is used whenever permalinks
are not enabled, such as when a WordPress blog is installed on a Microsoft server.
When permalinks are enabled, it is an alternative version of the URL. Both the
shortlink and the permalink versions of a page URL can be used to access any post
or page.



The problem with Yahoo picking up the shortlink version is that it creates a
potential duplicate content issue when two different URLs represent the same
web page. A secondary problem is that Yahoo should never have picked up the
shortlink URL because that WordPress site has always used permalinks. The only
place it could pick it up is in the head section of the web pages. The site does use
the canonical tag with the correct permalink version of the URL, which indicates
that Yahoo is ignoring the canonical tag.
To disable and remove the shortlink from the code is fairly easy. Just add the
following code to the functions.php script found in the theme directory for your
site. Add it after any initial commented lines and before the start of any functions
that might be found in the script.

?

remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0 );



The WordPress development team added the shortlink to the head section with
version 3.x. Why? Who knows. It is completely useless to include this line in the
head section. For some reason the development team has a history of adding
useless garbage to the head section of web pages.

				
DOCUMENT INFO
Categories:
Tags:
Stats:
views:10
posted:9/30/2011
language:English
pages:2