I need to do this for a theme:
remove_action( 'wp_head', 'rel_canonical' );
BUT I need to do that with conditional tags. The code below don’t work.
if(is_page('comment'))
{
remove_action( 'wp_head', 'rel_canonical' );
}
AND I need to do this with a plugin.
I tried to hook the if statement into the function test, like this:
add_action('init', 'test');
function test()
{
if(is_page('comment'))
{
remove_action( 'wp_head', 'rel_canonical' );
}
}
Because it is run before anything else the conditional tags don’t work, I guess.
Any ideas?
I found out that instead of using init as an action, I should use this:
Then it runs before the header.php but after the conditional tags are set.