Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to remove the canonical link reference from my page headers and I'm using the following code in my functions.php:

remove_action('wp_head', 'rel_canonical');

However, when I test the return value of remove_action it's value is FALSE and I notice that the canonical link reference is still rendered in the head of my pages.

I've tried wrapping the remove_action in an init but I get the same result:

function my_init()
{
   remove_action('wp_head', 'rel_canonical');
}

add_action('init', 'my_init');

How do I remove the canonical link reference from my page headers?

share|improve this question
    
Where is this action being set? –  Joseph Nov 12 '12 at 2:17
    
You mean by Wordpress? In wp-includes/default-filters.php line 209 –  Luke Nov 12 '12 at 4:20
1  
Works for me - are you using any plugins? –  TheDeadMedic Nov 12 '12 at 10:02
    
Which one is working for you? With or without the init? –  Luke Nov 12 '12 at 19:09

1 Answer 1

Locate the original add_action call and make sure that your remove_action call exactly mimics it including the $priority and $accepted_args parameters.

share|improve this answer
    
Already checked that. It's added in wp-includes/default-filters.php line 209. No priorities or other parameters are specified. –  Luke Nov 12 '12 at 2:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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