Overlapping meta descriptions with YOAST SEO Plugin for WordPress

The YOAST SEO Plugin for WordPress is amazing – I must admit. It has a gamification-/nudging effect (the stop lights – see picture below), that lets users improve their text’s according to Googles SEO laws. But if you, like me, is responsible for at great network of sites, maybe in a WordPress multisite setup, you will run into people who have a hard time getting to know the SEO world and won’t understand why SEO is important for their part of the website – this can cause tag overlapping meta descriptions or missing meta descriptions. It’s really bad (read fx @foundersgrid how just adding meta descriptions can growth hack your web page enormously) ! And you should do something about this.

yoast seo plugin for wordpress gameification nudging

Problem with overlapping meta descriptions with Yoast SEO plugin

So how do you get around the fact that the Yoast SEO plugin for WordPress will be overlapping meta descriptions on your WordPress installation – meaning that if your users don’t fill out the Yoast SEO part of the post, your pages will have no or two meta descriptions? I have found a solution to prevent overlapping meta descriptions with Yoast SEO plugin for WordPress right here. With just a simple code string in your WordPress themes Header.php-file, you’ll be up running in minutes. But first, let’s take a look at a few variables for the solution.

Theme dependent

Often I see people using a downloaded theme from free WordPress pages like “the +65 best free premium WordPress themes in 2016” or by it from ThemeForest WordPress themes or similar. This is great. Great that everybody can get started with their dream WordPress site quickly.

But the downside is truely, that you only have an idea of how the design works before purchasing, but no clue whatsoever what the code will look/work like. The code has very much to say considering SEO – also why you’d install the Yoast SEO plugin. Many of the themes I have purchased over the time are not that clever in terms of meta descriptions and keyword optimization.

Either there is no meta description in the header or the meta description is a static description – leaving you with absolutely no ability to affect your rankings in google.

Solution #1 – prevent overlapping meta descriptions

When you don’t care about ranking or SEO or you care very much about ranking and SEO

– there are two things you can do:

  • Your site has no meta description installed in the header.php in your themes folder:
    • Install Yoast SEO Plugin for WordPress and use it on every page – no exceptions.
    • Add a meta description, that is generated per single page and has individual content
  • Your site has a meta description that is individual f. page, but you can’t edit it in the WordPress editor
    • Install Yoast SEO plugin and use it on all pages – no exceptions – and out comment/delete the custom meta description field in your header.php in your theme folder.

Solution #2 – Implement overlapping meta descriptions

Multiple people (with and without SEO interest) write posts on your multisite -> manage meta descriptions

Solutions above are great choices for those situations. But when you support users who are not interested in SEO and may forget to fine-tune according to the Yoast SEO menu in the post editor, you need to support and prevent overlapping meta descriptions.  In this case, you need to manage meta descriptions.

When you install Yeast SEO plugin; the Yoast meta tags starts with this message, if you don not have edited the decryption meta tag:

yoast seo plugin overlapping meta descriptions code

<!-- This site is optimized with the Yoast SEO plugin v3.9 - https://yoast.com/wordpress/plugins/seo/ -->
<!-- Administrator besked: denne side viser ikke en meta-beskrivelse fordi den ikke har en. Du kan enten angive en specifikt for denne side eller gå til menuen SEO - Titles og opsætte en skabelon. -->

What I’ve learned is that you can have two (not the same as duplicate) meta descriptions added to the same page – have a look at the experiment on MOZ.com, which agrees (I advise not to have multiple title tags though). Because with Yoast SEO plugin installed, it kind of overrules the standard meta description tag for using the sharing options on fx facebook, LinkedIn and similar. In that case, you can control your sharing options through Yoast, and forget about the SEO part of Yoast because that has already been created by the solution script below.

Final solution / hack

So finally we are at the solution if you want to give some people possibilities for editing SEO relevant data associated with web texts, but not let them spoil their rankings because they forget to write a description. You actually just need to add the following in the top of your header.php, found in the “themes” folder.

<!-- title -->

<title><?php wp_title( '|', true, 'right' ); ?></title>

<meta name="description" content="<?php
$page_object = get_queried_object();
$post_id = get_queried_object_id();
$post = get_post( $post_id );
if ( $post ) {
echo wp_trim_words( $post->post_content );
<meta name="viewport" content="width=device-width, initial-scale=1">