-
Hi,
I’m experiencing an issue with the sub-category breadcrumb not displaying on product pages.
I’ve followed the tutorial steps however, when enabling “Show Category(s)” in general settings nothing changes.For example the breadcrumb is currently:
Home – All Plushies – Lucky Cat PlushieBut with the show category enabled it should be:
Home – All Plushies – Cats – Lucky Cat PlushieHave I’ve done something wrong? Any help would be greatly appreciated.
-
Hello,
Thanks for contacting us, and sorry for any inconvenience that might have been caused due to that.
Please try applying the following filter on your site to see if that works for you:
add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) { if ( is_product() ) { global $product; $category = get_the_category(); if ( count( $category ) > 0 ) { $cat_array = array(); $count = 0; foreach( $category as $cat ) { $cat_array[$count][0] = $cat->name; $cat_array[$count][1] = get_category_link( $cat->term_id ); $count++; } array_splice($crumbs,1, 1, $cat_array); } } return $crumbs; }, 10, 2);
Here’s how you can add filters/hooks 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.
Hi Sakib,
Thanks for the reply. I’ve added the code you provided above however, nothing seems to have changed. I downloaded the Snippet plugin and followed the instruction on the “How to” link.
Also, just to mention that I would like this to work for all products not just for the example above.
Maybe I’ve done something wrong or it’s being blocked by something?
Hello,
We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.
Please do take a complete backup of your website before sharing the information with us.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
Looking forward to helping you.
Thank you.
Hi Sakib,
I sent a support ticket to the theme creator(s) and they mentioned that they are aware of the issue and will be resolving it in the next theme update.
For now I will wait for the theme update and see how that goes. If it doesn’t solve the issue I will return and post and update with the information you mentioned above.
Many thanks for your continuous support.
Hello,
Sure! Let us know if the upcoming theme update fixes the issue for you.
We’ll keep this ticket open for you.
Thank you.
Hi Sakib,
Hope your well.
The theme developer provided me with this screenshot and said that this should help with solving the issue?
Not sure if it helps.
Hello,
Please note that you will have to select the sub-category as the primary category of your product if you want to add all the parent and child categories to the breadcrumbs. Please follow this guide to choose the sub-category as the primary category: https://rankmath.com/kb/how-to-choose-a-primary-category/
Let us know how that goes. Looking forward to helping you.
Hi,
Apologies, the above steps you provided do not help.
What would the next steps be?
Hello,
We appreciate your patience and cooperation as we try to resolve this issue for you. We apologize for any inconvenience this may have caused you.
In order to find out what is causing the problem and how to fix it, we need to take a closer look at your website settings and configuration. This will help us identify the root cause and provide you with the best possible solution.
Kindly follow the instructions we shared here to grant us access to your website.
Thank you for choosing Rank Math!
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hello,
I’ve checked your site, and the category “Cats” is not a child/subcategory of “All Plushies”.
Both of them are product categories, that’s why it’s not showing the hierarchal structure on your breadcrumbs where the show category option is enabled:
https://rankmath.com/kb/breadcrumbs/#num-2-10-show-categoryI’ve attached a screenshot in the sensitive data section where you can change the parent category of your product categories (not yet saved).
Hope that helps.
Thank you.
Hi Reinelle,
Thanks for the reply.
I’ve done what you mentioned above however, it didn’t change anything.
The outcome I’m looking for is whenever a user clicks on a product it shows the breadcrumb path of where that particular product is placed.For this example I will use the cat plushies. Clicking on the lucky cat plushie the breadcrumb shows this:
Home – All Plushies – Lucky Cat – Bell Collar Edition!All I would like it to show is:
Home – Cats – Lucky Cat – Bell Collar Edition!Instead of All Plushies.
It does do this if you click on any of the categories in the menu but once you go into a single product this shows the parent category.
If this is not possible its not the end of the world I just wanted to know if its possible.
Thank you for your continuous support.
Hello,
Thank you for that explanation.
The breadcrumbs you have shared for your products can be achieved, however, you may need to select the “Cats” category to be the primary term instead of “All Plushies”.
Please refer to the screenshot in the sensitive data section to choose the primary category. You can also see the same product showing the correct path.
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.
The ticket ‘Sub-Category Breadcrumb not showing’ is closed to new replies.