How to Remove Yoast SEO Meta Tags from Specific Pages?

Categories WordPress TutorialsTags , , , 3 Comments

Yoast SEO is the most popular WordPress SEO plugin. This plugin adds meta tags in a page to optimize the page in different platforms. Sometimes you might want to remove one or more meta tags from specific page(s). Let’s know, how to remove Yoast SEO meta tag(s) from specific post types or pages by custom functions.

Bydik Yoast SEO Meta Tags

Remove Yoast SEO Meta Tags

You might want to remove Yoast SEO meta tag(s) if the plugin generates a wrong one, if a page meta tags dedicated to another plugin or another purpose. You can do it by customizing Yoast plugin filter hooks, filer hooks available for almost all meta tags, thanks to Yoast for available hooks!

For example, add the function to remove description meta <meta name=”description” “#”/> tag from ‘about’ page (about is page slug). Just replace about with the page slug you want to apply the function. You can use conditional tags to specify the function where you want to apply.

// Remove Yoast meta description from About page
function remove_yoast_meta_desc_specific_page ( $myfilter ) {
    if ( is_page ( 'about' ) ) {
        return false;
    }
    return $myfilter;
}
add_filter( 'wpseo_metadesc', 'remove_yoast_meta_desc_specific_page' );

You can remove other meta tags too. To remove other meta tags, replace wpseo_metadesc with the meta filter hook you want to remove. Here’s the list of filter hooks and their frontend meta output –

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

** <title> meta tag cannot be removed, return false to ignore Yoast SEO title and print default page title.

Removing Multiple Yoast Meta Tags

You can also remove multiple meta tags from a page. Suppose you want to remove canonical meta tag and description meta tag from ‘about’ (about is page slug) page. Add the function to remove the tags –

// Remove multiple Yoast meta tags from About page
function remove_yoast_meta_tags_from_about_page ( $myfilter ) {
    if ( is_page ( 'about' ) ) {
        return false;
    }
    return $myfilter;
}
add_filter( 'wpseo_canonical', 'remove_yoast_meta_tags_from_about_page' );
add_filter( 'wpseo_metadesc', 'remove_yoast_meta_tags_from_about_page' );

You’ve learned the magic! Now you can remove duplicate meta tags or unwanted meta tags from a page easily. You can add the function in a site specific plugin or Functionality plugin.

That’s all! If you face problems, I want to hear from you. Let’s discuss through comments.

3 Comments on this.

  1. I only use Yoast for sitemaps, seo benchmark points and reading points. just love this feature. and I need to remove all meta tags. 🙂 excuse see that there is a shortcut that will allow me to remove meta tags in bulk.

Leave a Reply

Your email address will not be published.