Remove Breadcrumb Schema for select webpages on site

#930453
  • Bam MK
    Rank Math free

    Hi, I’m using Rank Math with Elementor in WordPress and I need to be able to remove the breadcrumb schema from certain pages on my site, but not all of them. How can I do that?

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

    Thank you for contacting us and bringing your concern to our attention.

    You can use the following filter code on your website to remove the Breadcrumb schema from specific pages based on their URL:

    add_filter( 'rank_math/snippet/breadcrumb', function( $entity ) {
        $urls_to_skip = array(
            'http://yoursite.com/page-url-1',
    	'http://yoursite.com/page-url-2'
        );
    
        $current_url = home_url( add_query_arg( null, null ) );
    
        if ( in_array( $current_url, $urls_to_skip ) ) {
            return false;
        }
    
        return $entity;
    });
    

    Please make sure to replace http://yoursite.com/page-url-1 with your actual page URL.

    Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

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

    Thank you.

    Bam MK
    Rank Math free

    Thanks. This doesnt seem to be working for me. I’m still getting two breadcrumblist results on the schema test.

    Hello,

    Could you please share the affected URL so we can check as well?

    You can add it to the sensitive data section by editing your first post

    Sensitive Data Section

    It is completely secure, and only our support staff has access to that section.

    Also, did you use an Elementor widget to add the breadcrumbs on your site? Or have it applied to your theme files?

    Looking forward to helping you.

    Bam MK
    Rank Math free

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    It appears that your URL has a trailing slash as the final URL path. Can you please include that in the array?

    You may check the updated code snippet we shared in the Sensitive Data section.

    Hope that helps.

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

You must be logged in to reply to this ticket.