i’m trying to hide the title tag of the head of my template. I’m using this code:
add_action( 'template_redirect', 'remove_wpseo' );
function remove_wpseo() {
if ( is_single ( 123456 ) ) {
global $wpseo_front;
if ( defined( $wpseo_front ) ) {
remove_action( 'wp_head', array ($wpseo_front, 'head' ), 1 );
} else {
$wp_thing = WPSEO_Frontend::get_instance();
remove_action( 'wp_head', array( $wp_thing, 'head' ), 1 );
}
}
}
But it does not work.
3
Answers
It will work. please add the page id in the condition like below:-
Please add below code in function.php and don’t forget to change page id with specific page from which you want to remove.
if ( get_the_ID()==96 )
You may try to visit the link here
Moreover, Try Yoast solution here
Hope this helps!
As of Yoast SEO 14.0, disable all Yoast output. Warning, the tags are removed. Taken from Yoast docs:
However, you might take a look at the new API, removing Title only:
Removing all default social_meta related tags:
Where presenters are for example (dump):