Remove sitenavigational element schema

#1090426
  • Resolved Prem Kumar
    Rank Math free

    I use Table of content from rankmatch and i dont want to add the toc schema.
    My point is, i want to show the toc in the posts and pages, but dont want to show the sitenavigational element schema, cause if my article got 50 headings, then my schema also generates 50 times

    @context

    https://schema.org

    @type

    SiteNavigationElement

    @id

    #rank-math-toc

    i triend to create rank-math.php and added the below code, still the SiteNavigationElement shows on all my articles schema. How to remove it? I want to show the table of contents but not SiteNavigationElement.

    Even you website rankmath uses table of content but SiteNavigationElement is not showing, how to do it>

    the code

    add_filter(‘rank_math/json_ld’, function($data) {
    if (isset($data[‘@graph’]) && is_array($data[‘@graph’])) {
    $data[‘@graph’] = array_filter($data[‘@graph’], function($node) {
    return !(isset($node[‘@type’]) && $node[‘@type’] === ‘SiteNavigationElement’);
    });
    $data[‘@graph’] = array_values($data[‘@graph’]);
    }
    return $data;
    }, 99);

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

    We apologize for the issue you are facing with the SiteNavigationElement schema being generated multiple times in your articles. Thank you for providing the code you tried to implement.

    The code snippet you provided seems to be on the right track, but there might be a couple of adjustments needed to ensure it works correctly. Here’s a refined version of your code:

    add_filter('rank_math/json_ld', function($data) {
        if (isset($data['@graph']) && is_array($data['@graph'])) {
            $data['@graph'] = array_filter($data['@graph'], function($node) {
                return !(isset($node['@type']) && $node['@type'] === 'SiteNavigationElement');
            });
            $data['@graph'] = array_values($data['@graph']);
        }
        return $data;
    }, 99);

    Make sure to add this code to your rank-math.php file correctly. If you have already done this and the SiteNavigationElement is still showing, please ensure that there are no other conflicting plugins or themes that might be adding this schema.

    If the issue persists, we recommend replying to your ticket with your site URL so that a human agent from our support team can take a closer look at your specific setup and provide more tailored assistance.

    Thank you for your understanding, and we’re here to help you resolve this issue!

    Sources:
    How to Make Your Theme Rank Math Compatible » Rank Math

    did, but it exists. I use generatepress theme and i have already disabled the schema entirely , using
    // Disable Generatepress schema completely

    add_filter( ‘generate_schema_type’, ‘__return_false’ );
    add_filter( ‘generate_navigation_microdata’, ‘__return_false’ );

    even your website users toc but it is not using sitenavigational element schema

    i’ve checked this article: https://rankmath.com/yoast-alternative/
    tell me how? the code you gave not working.

    what the heck is going on? why you’re not replying? worst behavior from rankmath support team…

    Hello,

    We deeply apologize for the unexpected delay in response. This ticket has been stuck in our drafts section for some reason.

    We checked your page but were not able to find the SiteNavigationElement schema there. Could you please confirm if you have already managed to remove this?

    However, it looks like you’re currently using the Rank Math PRO plugin on your websites, but the account you have used to open this ticket is the Rank Math free version.

    Please search and forward a receipt from FastSpring.com so we can locate your account and verify it.

    Looking forward to helping you.

    Thank you.

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

The ticket ‘Remove sitenavigational element schema’ is closed to new replies.