Hello,
Thank you for contacting Rank Math today.
Yes there is a way, you just need to customize the following filter and add it to your theme functions.php:
/**
* 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 ) {
return $crumbs;
}, 10, 2);
Hope this helps you. Thank you.
Can you please give me a “code snippet”?
Hello,
Here is an example to modify the breadcrumb value to get the value of the custom field.
/**
* this is an example to remove the second item in your post breadcrumbs
* 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 ) {
// Check if we are viewing single posts
if(is_singular('post')){
// Apply here your custom login to generate the final
// element of the breadcrumb (the breadcrumb title)
$newBreadcrumbTitle = "example";
// The last element in the $crumbs array is the post's
// breadcrumb title, so we have to update it:
$crumbs[count($crumbs)-1] = $newBreadcrumbTitle;
}
// And return the breadcrumbs
return $crumbs;
}, 10, 2);
This is just a format of how to, for further customization please seek the help of a developer
Hope that helps. If you have any further question(s), please let us know. Thank you.
Its only showing first letter of of the $newBreadcrumbTitle
Hello,
We can try and see if we can assist. Could you share the exact code you are using so far, you can use pastebin and share the link.
Looking forward to helping you. 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.