Remove author code from schema markup

#216401
  • Resolved Troy
    Rank Math free

    I would like to remove the author code from my schema markup.

    I don’t use AMP pages so I have no need for the author schema.

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention.

    You may need to use a filter to remove the author schema. Please refer to the code below and insert it into your theme’s functions.php file:

    /**
     * Filter to change the schema data.
     * Replace $schema_type with schema name like article, review, etc.
     *
     * @param array $entity Snippet Data
     *
     * @return array
     */
    add_filter( "rank_math/snippet/rich_snippet_{$schema_type}_entity", function ( $entity ) {
    	if ( isset( $entity['author'] ) ) {
    		unset( $entity['author'] );
    
    		return $entity;
    	}
    
    	return $entity;
    } );

    Please note you need to change the {$schema_type} to the object type you wish to modify.

    If you require any further assistance don’t hesitate to get in touch. Thanks

    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 ‘Remove author code from schema markup’ is closed to new replies.