Hide Person Schema from Product and Pages

#272978
  • Resolved Shadab Khan
    Rank Math free

    I am seeing person tab schema when I run my product url on Google Schema Tool and author data and gravator when i run any page of my e-commerce website, how to get rid of this on product and page but not on blog post?

    Screenshot-2

    Screenshot-3

Viewing 1 replies (of 1 total)
  • Anas
    Rank Math business

    Hello,

    Thank you for contacting Rank Math.

    You can try the following filter to remove the author information from the Schema of products and pages.

    add_filter( 'rank_math/json_ld', function( $entities, $jsonld ) {
     	if ( ! is_singular( 'product' ) && ! is_singular( 'page' ) ) {
    		return $entities;
    	}
    
    	if ( isset( $entities['ProfilePage'] ) ) {
    		$id = $entities['ProfilePage']['@id'];
    		foreach ( $entities as $key => $entity ) {
    			if ( isset( $entity['author' ]['@id'] ) && $id === $entity['author' ]['@id'] ) {
    				unset( $entities[ $key ]['author'] );
    			}
    		}
    		unset( $entities['ProfilePage'] );
    	}
    
    	return $entities;
    }, 999, 2 );

    You need to add the filter in the theme’s functions.php file.

    Here is a guide for your reference:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    I hope this helps.

    Thank you.

    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 ‘Hide Person Schema from Product and Pages’ is closed to new replies.