Hello,
Thank you for contacting the support and we regret the inconvenience caused.
By default, we do not include the post type name in the breadcrumbs. Could you confirm if you’re using any additional filters to add the post type name to the breadcrumbs of the CPT?
Also, as the URL is correct, please double check the singular and plural names of the CPT and update them if required and see if that helps.
Let us know how that goes.
Thank you.
Thanks for your reply. It looks like the breadcrumbs are using the title in the link text. Is it possible to have them use the slug instead? This is for both regular pages and the CPT on our site.
Hello,
Could you share some example URLs with these breadcrumbs so that we can have a closer look and suggest you a solution?
Looking forward to helping you.
Thank you.
Hi, so access to our dev site requires IP white listing so I’ll share some screengrabs if these will work… the RankMath breadcrumb code is under the page title where the house icon is.
This screengrab shows a page with a URL slug of “locations” and a longer page title. We would like the breadcrumb link text to use the URL slug instead of the page title:
https://snipboard.io/uKC0ks.jpg
This screengrab shows a custom post type “service” with a URL slug of “services” and page title of “services” We would like the breadcrumb link text to use the URL slug of “services” instead of the CPT single identifier
https://snipboard.io/YQvKGy.jpg
Hello,
Please try applying this filter code to your theme’s functions.php file:
add_filter( 'rank_math/frontend/breadcrumb/items', function( $crumbs, $class ) {
if(is_singular('locations')){ /* IF YOU ARE USING RANK MATH'S STANDARD LOCATIONS CPT, USE THIS INSTEAD: is_singular('rank_math_locations')*/
global $post;
$page_slug = $post->post_name;
$crumbs[count($crumbs)-1][0] = $page_slug;
}
return $crumbs;
}, 10, 2);
As for the service page, as mentioned by my colleague, Rank Math’s generation of breadcrumbs depends on the configuration of the post type you have created. Could you please ensure that you have set the plural text of the CPT Services as “Services”?
You may modify the filter above a bit if you wish to change the breadcrumbs text forcibly.
Looking forward to hearing an update from you.
Thank you! This is perfect and exactly what I was looking for!
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/#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.