This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Yoast SEO: Remove or customise the enhanced Slack data meta tags
Learn how to remove, add or customise Yoast SEO’s Enhanced Slack Data meta tags according to your requirements.
As of Yoast SEO 15.2, additional meta tags have been added to the header of WordPress websites containing information about the post or page being viewed.
On pages, this may appear like so, with an estimated reading time;
<meta name="twitter:label1" content="Est. reading time">
<meta name="twitter:data1" content="1 minute">
On pages, you might see the name of the author appear:
<meta name="twitter:label1" content="Written by">
<meta name="twitter:data1" content="Username">
This feature can be enabled or disabled from using the ‘Enhanced Slack sharing’ option found within the Features tab of the General page of the Yoast SEO settings.
It can also be disabled through the theme code by adding the following snippet to your functions.php or equivalent file. This will disable the enhanced Slack sharing tags throughout your site.
/**
* Remove enhanced Slack data
*/
add_filter('wpseo_enhanced_slack_data', '__return_false' );
In cases where you need to disable or modify the Enhanced Slack Data meta tags on a conditional basis, for example on a specific post type, you can extend the use of this wpseo_enhanced_slack_data
filter, like so:
/**
* Remove enhanced Slack data on Posts
*/
add_filter('wpseo_enhanced_slack_data', function($data) {
global $post;
if ($post->post_type == 'post')
{
return false;
}
else
{
return $data;
}
});
The $data
variable passed to the filter is an array of tags to be added, allowing you to easily modify or add to these according to your requirements. Just ensure you return the $data
variable as above. Here’s an example of how the $data
array looks on a Page where it returns the estimated reading time:
Array
(
[Est. reading time] => 5 minutes
)