Remove Person item from rank-math-schema script

#292337
  • Hi

    I want to remove the “@type”: “Person” item from the rank-math-schema script, because it is exposing the WordPress admin email, and I also that info is not related with the product page.

    Any way to do that?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    To remove the default Person Schema from your pages, you can add the following filter to your website:

    add_filter( 'rank_math/json_ld', function( $entities, $jsonld ) {
    
        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 );

    And here’s a link on how to apply a filter on your site:
    https://rankmath.com/kb/filters-hooks-api-developer/#how-to-add-code-snippets-to-rank-math-php

    I hope that helps.

    Thank you.

    Thanks

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

You must be logged in to reply to this ticket.