How to add employees schema?

#373516
  • Resolved Ross
    Rank Math free

    Hello I am trying to add employees schema to my organization but this code doesn’t work:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['publisher'] ) ) {
            $data['publisher']['employees'] = [
        { "firstName":"John", "lastName":"Doe" },
        { "firstName":"Anna", "lastName":"Smith" }];
        }
        return $data;
    }, 99, 2 );

    Can you help me?

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

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

    You need to replace the curly brackets with squared ones. Please refer to my filter below instead:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['publisher'] ) ) {
            $data['publisher']['employees'] = [
                [ "firstName" => "John", "lastName" => "Doe" ],
                [ "firstName" => "Anna", "lastName" => "Smith" ]
            ];
        }
        return $data;
    }, 99, 2 );

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Ross
    Rank Math free

    Thank you so much!

    Ross
    Rank Math free

    Hello again! Do you know why I see it twice? https://ibb.co/DVb8DWY

    I used this code:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['publisher'] ) ) {
            $data['publisher']['employees'] = [ "firstName" => "DelfĂ­n", "lastName" => "GarcĂ­a Blanco" ];
        }
        return $data;
    }, 99, 2 );

    Thanks!

    Hello,

    It seems that you already marked this ticket as “Resolved”.

    Do you still need our assistance regarding this issue? If you are, can you please ensure that you didn’t add the filter code twice on your website?

    Also, please share the affected URL so we can further check it from our end.

    Looking forward to helping you.

    Thank you.

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

You must be logged in to reply to this ticket.