Archived topic
Problem with hatom. Missing author
5 replies · Started by Enrico on April 21, 2017
Hi Tom,
I used your code https://gist.github.com/generatepress/67fb28af5c8be3103290 for a long time.
Google's Structured testing tool test was always with 0 errors and 0 warning. But in the Google webmaster console I had always errors in Structured data: missing author errors in category and blog pages.
I finally understood the problem. With you code all the author information in Hatom was removed in category and blog. Author information was present, but only in Creativework data, this is why it took me so long to understand the problem.
hatom should have this information:
author
@type
hcard
fn
Enrico F
url
https://sitename.it/author/ef/
n
With you code this information was removed. I think you should remove only the url not the fn.
Regards
Enrico
Can you try this updated code?: https://gist.github.com/generatepress/67fb28af5c8be3103290
Thanks a lot Tom, I tested it and this code don't remove the hatom for author. it removes correctly only the links to author page in categories, blog and posts.
The old code was removing also the date link in categories, blog and posts. Is it possible to remove also the date links?
Try this function:
add_filter( 'generate_post_date_output','tu_remove_date_link' );
function tu_remove_date_link() {
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
printf( '<span class="posted-on">%s</span>',
$time_string
);
}
Thanks a lot Tom! I added also this code and apparently everything is working. Now also the dates have no links.
There is something that can have problems with this code and that I have to check more carefully or is the same old code to remove dates links?
These functions I just provided are the latest/greatest way to do it - way better than overwriting the entire function :)