SEO Company

Our Blog

Missing meta description tag – Yoast SEO plugin

Missing-meta-description-tag-Yoast-SEO-plugin

Problem: missing meta description tag in

Recently, we had an issue where one of our client’s sites had the meta description tag missing from the page source code.
This was the meta description set through the Yoast SEO meta box in the back-end page editor, and would output into the page source code in the following format:

Solution: adding the missing wp_head() hook to the header.php file

First port of call, was to check the theme’s header.php file for the wp_head() hook, but none could be found.
Many plugins depend on this hook to add elements to the header.php of pages, such as meta tags.

After inserting this hook into the file, and reloading the page, the meta description tags, with the defined values set through Yoast, were visible and present in the page source code.

Guideline: on adding wp_head() to header.php

Adding the wp_head() hook into the header.php is quite simple and straight forward, all you need to do is make sure you add it in the right place, and that is before the closing header tag.

Description:
Fire the ‘wp_head’ action. Put this template tag immediately before tag in a theme template (ex. header.php, index.php).

Usage:

<!--?php wp_head(); ?-->

 

<!--?php ... /* Always have wp_head() just before the closing * tag of your theme, or you will break many plugins, which * generally use this hook to add elements to such * as styles, scripts, and meta tags. */ wp_head(); ?-->

How does this happen?

Themes must pass the theme review process before being made available via the WordPress.org theme repository, which is the official WordPress Theme directory.
The wp_head() hook is required in order to pass this process, so you can rest assured that any theme you download from the WordPress.org theme repository will contain this essential hook; any commercial theme should as well.
However, some custom bespoke themes may not, as they are usually exempt from the theme review process.

Contact Us Today

Category

Latest Blog

Contact Us

How Can We Help You?