Add alternateName schema to organization

#365102
Viewing 9 replies - 1 through 9 (of 9 total)
  • Hello,

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

    You might need to further extend your schema structure by customizing our filter code here: https://rankmath.com/kb/filters-hooks-api-developer/#extend-json-ld-data

    After you customize the filter code to edit your schema structure, you may apply the code to your theme’s functions.php file.

    Hope this helps you with your situation. Looking forward to helping you on this one.

    Thank you.

    Ross
    Rank Math free

    Hello again,

    I dont know how to properly insert this code

    "alternateName": [
        "LISER CUBIERTAS"
      ]

    in this funtion

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
    	return [];
    }, 99, 2);

    Hello,

    Please refer to this filter code instead:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['publisher'] ) ) {
            $data['publisher']['alternateName'] = [
                'LISER CUBIERTAS'
             ];
        }
        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!

    Hello,

    Glad that helped.

    Please feel free to reach out to us again in case you need any other assistance.

    We are here to help.

    Thank you.

    Ross
    Rank Math free

    Hello again, I would like to put more than one alternateName. How shoud I insert it in the filter?

    "alternateName": [
        "LISER CUBIERTAS",
        "Tejados LISER"
      ]

    I tried this and didnt work:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['publisher'] ) ) {
            $data['publisher']['alternateName'] = ['LISER CUBIERTAS'];
            $data['publisher']['alternateName'] = ['Tejados LISER'];
        }
        return $data;
    }, 99, 2 );

    Thanks

    Hello,

    You can simply add more items inside the array instead of assigning a new one. Please refer to my filter code here:

    add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
        if ( isset( $data['publisher'] ) ) {
            $data['publisher']['alternateName'] = [
                'LISER CUBIERTAS',
                'Tejados LISER'
             ];
        }
        return $data;
    }, 99, 2 );

    This code should work and shouldn’t cause any issues when you check it in the Rich Result Test.

    Let us know how that goes. Looking forward to helping you.

    Ross
    Rank Math free

    Very grateful!

    Anas
    Rank Math business

    Hello,

    If you have any questions 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 9 replies - 1 through 9 (of 9 total)

The ticket ‘Add alternateName schema to organization’ is closed to new replies.