Hello,
Thanks for contacting us and sorry for any inconvenience that might have been caused due to that.
I checked your site and pasted this code in your child theme’s functions.php file:
/**
* 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 ) {
//Adding to single posts
global $post;
if(is_singular('product')){
$subcatname = $crumbs[2][0];
$newValue[] = array(
$subcatname,
'',
'hide_in_schema' => false
);
array_splice( $crumbs, 2, 1, $newValue );
return $crumbs;
}
return $crumbs;
}, 10, 2);
And now your product category is visible in the breadcrumbs but it doesn’t have a link.
Please check and confirm. We really look forward to your update.
Hey Jaideep,
That’s exactly what I wanted! Thanks a lot! Is it possible to do this for the the taxonomies for the blog, events and my custom taxonomy Publications (publicatie_categorie)
Hope to hear from you soon!
Regards,
Joost
Hello,
Thanks for getting back.
Yes, it can work for all post types. You will just have to customize the ‘if’ statement if(is_singular('product')){ in the code to make it work for different post types. And if you want to use it for all the breadcrumbs then you can simply delete the if statement.
If you want to use it for all post types then please delete the code I pasted before from your functions.php file and use the code given below:
/**
* 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 ) {
//Adding to single posts
global $post;
$subcatname = $crumbs[2][0];
$newValue[] = array(
$subcatname,
'',
'hide_in_schema' => false
);
array_splice( $crumbs, 2, 1, $newValue );
return $crumbs;
}, 10, 2);
Hope this helps. Let us know if you need any further assistance.
Hey Jaideep,
When I put your ‘all’ code, everything works perfectly.
Thanks a lot!
Hello,
We are super happy that this issue is already resolved. If you have any other questions in the future, know that we are here to help you.
If you don’t mind us asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.