GSC Errors “offers”, “review”, or “aggregateRating” – code breaks site

#78179
  • Resolved Megan J.
    Rank Math free

    Hi,

    I had the worning for Either “offers”, “review”, or “aggregateRating” should be specified in Google Search Console and followed a previous ticket thread on the forum (which was very useful) but when I followed the advice to mannually ad the code for brand (which is below) it completely broke my site. There was a critical error and I was only able to get into my site via FTP. I removed the code from the theme funcions.php file and everything went back to normal.

    // Add Brand for Products.
    add_filter( ‘rank_math/snippet/rich_snippet_product_entity’, function( $entity ) {
    $entity[‘brand’] = ‘Rank Math’;
    return $entity;
    });

    Does anyone know what could have gone wrong? I really want to add the brand.
    The only thing that I come up with is that when I replaced $entity[‘brand’] = ‘Rank Math‘; with my brand name it was quite long – 3 words and in Cyrillic. Maybe I should only put the name of the brand and in Latin letters?

    Any advice is highly appreciated!

    Cheers,
    Megan

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    The single quote doesn’t look right in the code. Please try adding following code in your theme’s functions.php file before closing php tag i.e ?>:

    
    // Add Brand for Products.
    add_filter( 'rank_math/snippe/rich_snippet_product_entity', function( $entity ) {
    	$entity['brand'] = 'Rank Math';
    	return $entity;
    });
    

    This should fix the issue.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘GSC Errors “offers”, “review”, or “aggregateRating” – code breaks site’ is closed to new replies.