Google Search Console – “Missing: Updated” WordPress fix

In Google Search Console under Search Appearance > Structured Data, I found many errors for my WordPress website. The errors were all the same, Missing: Updated.google_search_console

This means that for each WordPress blogpost or article, that page did not have the updated microdata. So to resolve this error message, I had to add the missing updated field somewhere to each blog post.

The easiest method was opening my functions.php file within the theme directory and add this code to it:

function add_atom_data($content) {
 $t = get_the_modified_time('F jS, Y');
 $author = get_the_author();
 $title = get_the_title();
if (is_home() || is_singular() || is_archive() ) {
 $content .= '<div class="hatom-extra" style="display:none;visibility:hidden;"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>';
 }
 return $content;
 }
add_filter('the_content', 'add_atom_data');

What this code does, is adding a <span> within a <div> and add the microdata of that page to it. In my case, I did not want to show this extra information to the user, so I have hidden this div by using style=”display:none;visibility:hidden;”.

 

Author Bio

Thank you for your interest in my blog! On this miniblog, I write mostly short (technical) blog posts that might interest other people. Read more about me or feel free to contact me.

 

5 thoughts on “Google Search Console – “Missing: Updated” WordPress fix

Leave a Reply

Your e-mail address will not be published. Required fields are marked *