[Resolved] Google Console Errors – Missing author/title/updated

  • Author
    Posts
  • #7933

    Andrew Misplon
    Keymaster

    Hi Reid

    Thanks again for posting.

    That’s my fault, try the following instead:

    if ( ! function_exists( 'ultra_post_class_filter' ) ) :
    /**
    * Filter post classes.
    * @link https://codex.wordpress.org/Function_Reference/post_class.
    */
    function ultra_post_class_filter( $classes ) {
    	$classes[] = 'post';
    
    	// Resolves structured data issue in core. See https://core.trac.wordpress.org/ticket/28482.
    	if ( is_page() ) {
    		$class_key = array_search( 'hentry', $classes );
    
    		if ( $class_key !== false) {
    			unset( $classes[ $class_key ] );
    		}
    	}
    
    	$classes = array_unique( $classes );
    	return $classes;
    }
    endif;
    add_filter( 'post_class', 'ultra_post_class_filter' );
    #7934

    Reid
    Participant

    Great, thanks. Revised the code as instructed and the errors are no longer appearing. Will validate with console over the next few days to see if the crawl errors resolve. I appreciate all you help!

    #7935

    Andrew Misplon
    Keymaster

    Super, glad that helped.

    On your blog page and single post pages, the author, updated time and title are all there. The snippet you’ve used will hopefully allow Google to differentiate between pages and posts (syndicated content), thereby not expecting all that info from pages.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Scroll to top