Squirrel Framework

Remove WP Yoast SEO Meta Tags using WordPress Filter

YoastSEO the only effective Search Engine Optimization plugin for your WordPress website. Small scale websites using this plugin can easily boast SEOs without any hassle. However, customized CMS built over WordPress may add some extra effort to understand this plugin for Search Engine Optimization.

Most of the advanced developers will face SEO Meta problem in Yoast Plugin or it may add duplicate meta tags in head. Nobody is at fault here, but to fix such problems, Yoast Developers have already prepared set of filters to remove such conflicts with other plugins or themes.

Fix Yoast SEO Tag by Filter

Add the following code in your theme’s function.php along with the filter hook, listed below in the table:

function joe_remove_yoast_meta ($filter) {
  // Add your conditions here, in case you want to remove Meta Robots from the Archive Template
  if(is_archive()){
     return false;
  }
  return $filter;
}
add_filter( 'wpseo_robots', 'joe_remove_yoast_meta' );

Remove Multiple Yoast Meta Tags

Add the following code in your theme’s function.php along with the desired filter hooks, listed below in the table:

function joe_remove_yoast_meta ($filter) {
  // Add your conditions here, in case you want to remove Meta Robots from the Archive Template
  if(is_archive()){
    return false;
  }
  return $filter;
}
add_filter( 'wpseo_canonical', 'joe_remove_yoast_meta' );
add_filter( 'wpseo_metadesc', 'joe_remove_yoast_meta' );

Filter List for Yoast Meta Output

Below is the complete list of WordPress Yoast Plugin Meta Ouput:

Filter HookMeta Output [# = Dynamic Value]
wpseo_title<title>#</title>**
wpseo_robots<meta name=”robots” content=”#” />
wpseo_canonical<link rel=”canonical” href=”#” />
wpseo_metadesc<meta name=”description” content=”#” />
wpseo_metakeywords<meta name=”keywords” content=”#” />
wpseo_locale<meta property=”og:locale” content=”#” />
wpseo_opengraph_title<meta property=”og:title” content=”#” />
wpseo_opengraph_desc<meta property=”og:description” content=”#” />
wpseo_opengraph_url<meta property=”og:url” content=”#” />
wpseo_opengraph_type<meta property=”og:type” content=”website” />
wpseo_opengraph_site_name<meta property=”og:site_name” content=”#” />
wpseo_opengraph_admin<meta property=”fb:admins” content=”#” />
wpseo_opengraph_author_facebook<meta property=”article:author” content=”#” />
wpseo_opengraph_show_publish_date<meta property=”article:published_time” content=”#” />
wpseo_twitter_title<meta name=”twitter:title” content=”#” />
wpseo_twitter_description<meta name=”twitter:description” content=”#” />
wpseo_twitter_card_type<meta name=”twitter:card” content=”#” />
wpseo_twitter_site<meta name=”twitter:site” content=”#” />
wpseo_twitter_image<meta name=”twitter:image” content=”#” />
wpseo_twitter_creator_account<meta name=”twitter:creator” content=”#” />
wpseo_json_ld_output<script type=”application/ld+json”>#<script/>
Filter HookMeta Output [# = Dynamic Value]
Exit mobile version