rank_math_the_breadcrumbs() issues

#59588
  • Resolved The GSC
    Rank Math free

    Hi,

    I’m having a tricky issue with using rank_math_the_breadcrumbs() on a CPT, where for some reason the category is being output before the archive/post type. In the attached image, you’ll see that Food Services & Catering (category) is before Community Services (Post Type). Any suggestions?

    Similarly s there a filter to override the structure of the breadcrumbs, and bring it more in line with the standard ol > li > a (see google developer reference)?

    TIA!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Alberto
    Rank Math business

    Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Is it happening everywhere on your website?

    ​​​​​​​Assuming you are using the latest version of all the plugins and the themes (please update if not yet), it could be a conflict with one of the plugins or the theme you are using.

    To determine that, please follow this troubleshooting guide:
    https://rankmath.com/kb/check-plugin-conflicts/

    Please let us know if you find the culprit.

    Only the site admin would know and your users won’t be affected by this troubleshooting.

    Looking forward to helping you.

    Hi, it’s only happening with this one CPT, and persists even when all other plugins (except for the CPT itself course) are disabled.

    I’m not expecting you to solve this for me. Just looking for direction: what’s the function the builds the breadcrumb, how does it get the parent hierarchy, etc.

    (PS: you seem to have missed my connected connection: is there a filter that controls the breadcrumb output/ html markup?)

    Alberto
    Rank Math business

    Hello,

    In your case, since it is only happening in one CPT, you could do a quick workaround using a filter: swap the items to match the order you want.

    /**
     * Allow changing or removing the Breadcrumb items
     *
     * @param array       $crumbs The crumbs array.
     * @param Breadcrumbs $this   Current breadcrumb object.
     */
    add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
            // First you should check if we are in your problematic CPT
            if(....){
              // And now you do the swap
              $tmp_var = $crumbs[0];
              $crumbs[0] = $crumbs[1];
              $crumbs[1] = $tmp_var;
            }
    	return $crumbs;
    }, 10, 2);

    We have several filters to modify the breadcrumbs (the output, the strings, the elements…), you can check all of them here: https://rankmath.com/kb/filters-hooks-api-developer/#change-breadcrumb-settings

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

The ticket ‘rank_math_the_breadcrumbs() issues’ is closed to new replies.