0

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

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

2 Answers 2

3

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 );
}
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 agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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