Hello,
Thank you for contacting Rank Math today.
Thank you for the suggestion, I will pass this on to our developers.
Here is an example of how to add a crumb to the trail using the array_splice() function:
/**
* 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
if(is_singular('post')){
//pass an array containing the name of the crumb, URL and
//hide_in_schema option
$value[] = array(
'Custom Page',
'http://localhost/rankmath',
'hide_in_schema' => false
);
//add this value as the second item in array
array_splice( $crumbs, 1, 0, $value );
return $crumbs;
}
return $crumbs;
}, 10, 2);
Looking forward to helping you. Thank you.
Thank you very much, it worked 🙂
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do 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.