Default Schema Problem

#768509
  • Resolved Anonymous
    Rank Math free

    https://imgur.com/nkO9zQT
    Hello, Organization and SearchAction schemas are automatically added to my homepage, even though I manually create schemas. I delete the schemas from other pages, but Organization schema is still added to those pages. How can I prevent them from being automatically added?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello, thank you for reaching out about the default Schema problem you are facing with the Organization and SearchAction schemas being automatically added to your homepage. To prevent these schemas from being automatically added, you can follow these steps:

    1. Remove Organization Schema from All Pages Except Homepage:
      You can use the provided code snippet to remove the Organization Schema from all pages except the homepage. Here is the code snippet:

      add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
       if ( is_front_page() || ! isset( $data['publisher'] ) ) {
           return $data;
       }
       unset( $data['publisher'] );
       unset( $data['place'] );
       return $data;
      }, 99, 2);
    2. Remove Organization Schema from the Homepage:
      If you want to remove the Organization Schema just from the homepage, you can use this code snippet:

      add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
       if ( ! is_front_page() || ! isset( $data['publisher'] ) ) {
           return $data;
       }
       unset( $data['publisher'] );
       unset( $data['place'] );
       return $data;
      }, 99, 2);

    Please ensure that you have sound knowledge of what you are doing before attempting to remove any Schema entity. Also, it’s not recommended to remove global entities as it could break the Schema structure.

    If you need further assistance or have any other questions, feel free to ask. Thank you for bringing this concern to our attention!

    Sources:
    Remove Organization Schema from Your Website » Rank Math
    Resolving Rank Math Schema Markup Related Issues
    Carousel Search Results » Rank Math
    Removing Schema From Your Posts & Pages » Rank Math
    Resolving Rank Math Schema Markup Related Issues

    Anonymous
    Rank Math free

    Hello, which file and section should I add this code to?

    Anonymous
    Rank Math free

    I also want to delete the SearchAction schema

    Hello,

    Thank you for your patience.

    The code should be added to your child theme’s functions.php file or you can follow any method in our guide here:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Regarding the searchAction schema, please add this filter to remove it from your homepage:

    /**
     * Filter to enable/disable SearchAction JSON-LD data
     */
    
    add_filter( 'rank_math/json_ld/disable_search', '__return_true' );

    Hope that helps.

    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 4 replies - 1 through 4 (of 4 total)

The ticket ‘Default Schema Problem’ is closed to new replies.