How To Disable and Remove Shortlink Link Rel Hook in WordPress Header

A new WordPress feature has been addeed to the core which supports shortlink, called WordPress 3.0. Shortlink is the short version of URL for the web page. Where you can make SEO friendly URL link with many key words shorted to a few characters after domain name in URL.

In order to support pointing and redirection of shortlink to the post, WordPress adds a line of HTML code as meta tag in the header of the front end web content page, which has the following format: Its default shortlink will be in the form of ? p=ID syntax, where ID represents ID number of the post or page in WordPress.

Shortlink URL can be called in the theme’s templates by WordPress with the shortlink(); function. But who does not use shortlink, the additional link meta line in the header is not useful. And unnecessary increase a few bytes of HTML pages that may waste bandwidth. This is making easy for the webmasters to shorten the shortlink. So, Webmasters can easily remove the shortlink link in the WordPress header by using one of the following methods.

First Method : Remove Shortlink via functions.php in WordPress Theme

Login to the web host, and navigate to /wp-content/themes// directory. Then edit the functions.php to include the following line of code:

remove_action( ‘wp_head’, ‘wp_shortlink_wp_head’, 10, 0 );

Save the modified functions.php, and the shortlink code in header will be removed with immediate effect.

Second Method : Disable Shortlink via WordPress Plugin

Copy and paste the following text into a text editor, and save the file
with a name ends with .php extension. Just For example, wp-no-shortlink.php.

Share This Post

Related Articles

Leave a Reply

© 2013 Techibuzz. All rights reserved. Site Admin · Entries RSS · Comments RSS
Powered by WordPress · Designed by Theme Junkie