I want to remove the short link header tag from a specific page. Please suggest me a filter guys. I want to remove the entire

<link rel='shortlink'... 

section from a specific page. Adding a filter to the wp_shortlink_wp_head will work fine? I am not sure whether i can add filter to the function just like that...

Thank you

  • There is not enough information to answer this question. Sounds theme specific though. – s_ha_dum Jan 27 '13 at 15:27

Replace 2 for ID of your page. Insert into your functions.php

if ( is_page(2) ){
   remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
}

Talk about resurrecting an old question....

I had to do this recently with WordPress 4.5.3 and it didn't work at all. To make it work, I needed to wrap up the if statement in a function called by wp_head - like so:

function remove_shortlink() {
    if( is_page(2) ) {
        remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );
    }
}
add_action( 'wp_head', 'remove_shortlink', 1 );

Replace '2' with the ID of your page. Add this to your theme's functions.php or in a plugin

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.