サーチコンソール hentry/hatom構造化データのエラー

Search Console の構造化データでエラーがでてました。

Search Console 構造化エラー

Search Console 構造化エラー

調べたみたら、 hentry というclassがあると構造化データである宣言になり、 Microformats で定義にそってマークアップがされてないからエラーなってしまうようです。

エラーが出た項目は記事ページの author と、固定ページの authorとupdated でした。
記事ページの author は不要だと思ってはずましたわ…。
固定ページは author / updated をはずすような変更してなかったはずなのですが。うーむ?

記事ページの author

外観>テーマの編集>template-tags.php の twentyseventeen_posted_on() を以下のように修正

function twentyseventeen_posted_on() {
	echo '<span class="posted-on">' . twentyseventeen_time_link() . '</span><span class="author">' . get_the_author() . '</span>';
}

ついでに、author表示不要なので .entry-meta .author は display:none しておきました。

固定ページの author と updated

固定ページの構造化は不要かな、と思ったので
wp-includes/post-template.php
を以下のように変更しちゃいました。。。

function get_post_class( $class = '', $post_id = null ) {
	// 省略
	// hentry for hAtom compliance
	if(! is_page() ){
		$classes[] = 'hentry';
	}
	// 省略
}

(ダメなカスタマイズ例ですねこれは…)