Unable to remove yoast created meta tags using Yoast suggested snippets
-
Hi
I am unable to remove yoast created meta tags, e.g. canonical, or date plulished using Yoast suggested snippets: https://developer.yoast.com/customization/apis/metadata-api/#removing-meta-tags.
This is the code i am using, to, unsuccessfuly, remove the canonical meta tag:
/**
* Removes the canonical URL from the presenters.
*
* @param array $presenters The registered presenters.
*
* @return array The remaining presenters.
*/
function remove_canonical_presenter( $presenters ) {
return array_map( function( $presenter ) {
if ( ! $presenter instanceof Canonical_Presenter ) {
return $presenter;
}
}, $presenters );
}
add_action( 'wpseo_frontend_presenters', 'remove_canonical_presenter' );I added the above code to functions.php
This is an example of an article i want to remove the meta tags from: https://www.proneg.co.uk/news/can-i-sue-my-surveyor-negligence/ – you can view source and see the canonical meta tag still there.
I don’t actually want to remove the canoical meta tag, i want to remove the published date meta tag, but given that you have provided code to remove the canonical meta tag but I cant get that to work, this will be a good place to start.
Thanks
Matt
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.