Breadcrumbs with non-clickable blank pages

#404082
  • Resolved Ivan Lopez
    Rank Math free

    Hello, maybe I’m not doing it right but I want to tell you my problem.

    I have a site with first 2 levels without content since they are titles to order the content and in a 3 level we have all the content pages. When including the breadcrumbs I made blank pages for each level 1 and level 2 to be able to make the correct hierarchy and that in the breadcrumb is a perfect sitemap.

    HOME / level1 / level2 / level3(content)

    The problem I have is that if you click on level 1 or level 2 as it is an empty page it directs you to a blank page and it is not interesting.

    I would like to make these two levels not clickable so that it is not a navigation error. Can you help me? Thank you very much

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    Could you please try this filter to make the 2nd and 3rd crumbs non-clickable?

    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
    	$crumbs[0][2] = '';
            $crumbs[0][3] = '';
    	return $crumbs;
    }, 10, 2);

    The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    Once done, clear your website’s cache and check again

    I hope that helps.

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

The ticket ‘Breadcrumbs with non-clickable blank pages’ is closed to new replies.