Skip to content

Instantly share code, notes, and snippets.

@eddt
Created July 7, 2016 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddt/c107dfc4366469bd6eb83a5e77e3a5f4 to your computer and use it in GitHub Desktop.
Save eddt/c107dfc4366469bd6eb83a5e77e3a5f4 to your computer and use it in GitHub Desktop.
Google Search Console Hentry error fix
<? php
//Fix for missing author, entry title, and updated in GSC
////add hentry data
function add_hentry_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="hentry-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_hentry_data');
@eddt
Copy link
Author

eddt commented Jul 7, 2016

Should add this to every function script!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment