Google’s Webmaster Tools is very useful when you must assess how Google sees your sites. In order to use rich snippets and other features in search results it tries to understand the markup on your pages. However it’s possible that some of that markup to be incomplete or malformed. In this case the Structured Data page will show these errors.
The most common errors encountered on WordPress based sites are in the Microformats.org markup, namely missing update and missing author.
I’m not entirely sure, but these errors could, I say could, affect the page rankings, so it’s always a good idea to get rid of them.
Update: December 2018
It seems that, these days, the structured data errors are no longer an issue, with so many advancements in the currently available themes, and with the WordPress itself, which has evolved massively since I first wrote this article. And let’s not forget all those SEO plugins out there, which will definitely solve any such problem easily.
How to fix these errors?
In the picture below you can see my Structured Data page after I corrected these errors. Observe how the errors are going down steadily. It takes time until Google re-crawls all your pages.
In case you are using WordPress as your blogging platform, the guilty element is the theme you are currently using, not WordPress itself. Fortunately it’s quite simple to add the missing markup elements. For the vast majority of themes, the file that must be modified is single.php, and maybe also page.php. In some rare cases could be other files. Anyway, you should find all template files involved in displaying posts/pages in full or excerpt form.
The theme files to edit are located in a directory of this form:
/<site’s root>/wp-content/themes/<theme directory>
It’s best to use a child theme and make all changes there. This way your changes won’t disappear at the next theme update.
Now let’s go into details on how to fix structured data errors.
Fixing the “Missing: update” Error
- Locate the function displaying the date of the post within the single.php file:
<?php the_date(); ?>
I’m using a Builder theme (I’m one of those “rare” cases), and I found my date function in post-formats/content.php and post-formats/content-single.php, and the date function used was
get_the_date(), but you get the point.
- Wrap this code snippet with a
<span>element having style classes
"post-date updated", like this:
<span class="post-date updated"><?php the_date(); ?></span>
In case there is already a span element wrapped around the date function, make sure it has these two style classes assigned: post-date and updated.
Fixing the “Missing: author” error
- Locate the function displaying the post author within your single.php file:
<?php the_author(); ?>
Again, the file(s) and function may be different. In my Builder theme I found a custom function
builder_get_author_link()in the same two files.
- Wrap the code snippet with two
<span>elements, like this:
<span class="vcard author post-author"> <span class="fn"> <?php the_author(); ?> </span> </span>
<span>element is necessary because the vcard markup requires at least one child element.
How to edit the files?
The hosting companies usually provide some sort of file management application available through their CPanel interface, but the best choice would be an FTP client. You can download the file, edit and then re-upload later.
Personally, I’m using the free WinSCP which allows me to edit the files directly. It downloads and then re-uploads the file behind the scenes, so it’s quite handy for editing.
If you are using any kind of caching mechanism or plugin, make sure you purge it after you finish with the changes.
You may check if everything is OK by using the structured data testing tool here:
Next, you’ll have to wait until Google re-crawls all your posts/pages. This may take between one and two weeks. As you can see in the picture above, my errors are constantly going down.
PS: This article was about the most frequent Microformats.org markup errors. Microformats.org markup is based on style classes assigned to normal HTML elements. It is entirely up to the current theme how well it is implemented.
With the advent of HTML5 a more modern markup style was born, Schema.org. Find out how to add rich snippets even if your theme does not have any structured data markup whatsoever.
PPS: I hope you enjoyed reading this post. If you liked it, please leave a comment or share it.