hentry (markup: microformats.org) error – Missing: updated in search console

Posted in: Newspaper
Post count: 49

I’ve been getting Missing: updated errors in my Google search console. I’ve been trying various options such as :

1) https://forum.tagdiv.com/topic/error-with-microformats-can-i-repair-this/
2) https://forum.tagdiv.com/topic/updated-author-and-entry-title-search-console-markup-microformats-org/

But, both could not help me. Instead when I added the code as described (https://thomas.vanhoutte.be/miniblog/missing-updated-wordpress/) and added the following code in functions.php, the error is completely resolved

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’);

But, whenever the newspaper theme is updated, this code is getting deleted automatically. Is there any way so that the above code which is in my theme functions.php is retained while updating the newspaper theme.

Kindly suggest.

Post count: 22421

Hello,

A theme update will always replace the old files with the new ones so basically your old files will get deleted and the new ones put in their place. Your customization will be lost. Functions.php can be re-written from the child theme though:
https://code.tutsplus.com/tutorials/a-guide-to-overriding-parent-theme-functions-in-your-child-theme–cms-22623

Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.