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?
Locate the original
add_action
call and make sure that yourremove_action
call exactly mimics it including the$priority
and$accepted_args
parameters.