Archived topic
Invalid value in field "itemtype"
7 replies · Started by Omri on March 11, 2022
Hey guys,
I keep getting this error message from search console:
Unparsable structured data > Invalid value in field "itemtype"
I get this message for all of my pages. Most places say it's a theme issue so I looked around GP support forum for answers but couldn't find any solutions.
Would appreciate your help
I'm using Premium Version 2.1.2
Hi there,
does it provide more info - such as the element that is invalid ?
Nothing specific. I added a link to Rich Results Test, maybe that can mean something to you.
Do you have any custom functions or elements that are adding Author meta to your site ?
Yes, I have the following snippets:
Snippet 1:
add_filter( 'author_link', 'my_author_link' );
function my_author_link() {
return home_url( 'about' );
}
Snippet 2:
add_filter( 'generate_post_author', '__return_false' );
add_filter( 'generate_post_date_output', function( $date ) {
printf(
'<span class="meta-gravatar">%s</span>',
get_avatar( get_the_author_meta( 'ID' ) )
);
echo '<span class="meta-data">';
printf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="httpss://schema.org/Person" itemscope="itemscope" itemprop="author"><a href="%1$s" title="%2$s" rel="author"><span class="author-name" itemprop="name">%3$s</span></a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() )
)
);
echo $date;
echo '</span>';
} );
Snippet 3:
add_action( 'generate_after_entry_header', 'tu_page_meta' );
function tu_page_meta() {
if ( 'page' == get_post_type() && ! is_page( array( 10, 15, 20 ) ) ) : ?>
<div class="entry-meta">
<?php generate_posted_on(); ?>
</div><!-- .entry-meta -->
<?php endif;
}
In Snippet 2 - see this line:
sprintf( '<span class="author vcard" itemtype="httpss://schema.org/Person" itemscope="itemscope" itemprop="author"><a href="%1$s" title="%2$s" rel="author"><span class="author-name" itemprop="name">%3$s</span></a></span>',
In there you see:
itemtype="httpss://schema.org/Person"
notice the https is incorrect, it has one too many s - change it to:
itemtype="https://schema.org/Person"
Yup that was the problem. Thank you David!
You're welcome