sameAs Schema Markup

#221548
  • Resolved Bruno Bincoletto
    Rank Math free

    I’m trying to add the sameAs filter on the Organization data with the code below.

    add_filter('rank_math/json_ld', function( $data, $jsonld ) {

    $currentSameAs = $data['Organization']['sameAs'];
    $currentSameAs[] = "https://www.instagram.com/aaaaaa";
    $currentSameAs[] = "https://www.facebook.com/aaaaaa";
    $currentSameAs[] = "https://www.linkedin.com/company/aaaaaaa";
    $data['Organization']['sameAs'] = $currentSameAs;
    return $data;

    }, 10, 2);

    It appears, however outside the organization keys, not validating in the Google test

Viewing 3 replies - 1 through 3 (of 3 total)
  • Ankit
    Rank Math business

    Hello,

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

    Please use the following code and add it inside your current theme’s function.php file.

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['publisher'] ) ) {
            $data['publisher']['sameAs'] = [
                'https://www.instagram.com/example',
                'https://www.facebook.com/example',
                'https://www.facebook.com/groups/example',
                'https://www.youtube.com/channel/example',
                'https://inkedin.com/example'
            ];
        }
        return $data;
    }, 99, 2 );;

    Make sure to remove the previous code.

    Looking forward to helping you. Thank you.

    Works! Thanks!

    Anas
    Rank Math business

    Hello,

    We are super happy that your issue is resolved. 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)

The ticket ‘sameAs Schema Markup’ is closed to new replies.