WordPress SEO by Yoast is undoubtedly powerful seo plugin for wordpress websites and it has many built in features such as XML sitemaps, Breadcrumb navigation, file editor and still more. But Yoast Breadcrumb navigation does not have enough features and options to control them which results breadcrumb navigation looks ugly (in my perspective) and it shows duplicate post title trailing with breadcrumb navigation.
There is a post title already there in native wordpress themes and again showing the same variable with Yoast breadcrumb navigation not quite good. Sometimes, if the post title gets longer, it wraps down to second line and looks fishy. When i search for the solution via google, unfortunately there is no solution which works successfully. So, i did request my friend Mr.Kannan (CEO of corel web designs) to find the solution for this issue. After some in-depth analysis (2 hours+) he added a new function to get rid of post title trailing with breadcrumb navigation without hacking the original WordPress SEO plugin core files. It works!
Here i am sharing the code with you who is interested to get rid of post title trailing from the Yoast SEO plugin breadcrumb navigation. Simply add the below code in your functions.php file (probably in your wordpress child theme) and make the necessary changes in your single.php as well.
function adjust_single_breadcrumb( $link_output) { if(strpos( $link_output, 'breadcrumb_last' ) !== false ) { $link_output = ''; } return $link_output; } add_filter('wpseo_breadcrumb_single_link', 'adjust_single_breadcrumb' );
If you found any difficulties to apply this technique, post your comment below using the comment form. Your valuable suggestions are always welcome.
I need the final breadcrumb to be a link, but not the current page. e.g. Home/Car/Ford and then the page title is Fiesta which is not in the breadcrumb.
Any ideas?
Hello andrew
Final breadcrumb? Which one you are referring about? Did you refer some live websites who have this feature?
I have tried several codes but since the last SEO YOAST update (now is march 2015), this is the only php snippet that works.
Thank you very much.
Thank you so much, nothing else has worked for the new update ( March 2015 ), I already have it under another breadcrumb function so – took out the top line and it works perfectly.
Excellent! Worked perfectly, thank you!
-Cheers!
Hello, I’m new to coding so please bare with me! Would you mind telling me where the code goes in the function file and the single file? Could you please explain how you install this line of code in the function and single files? Where does it goes?
Hi alaster
If you already installed Yoast SEO plugin and included the snippet to render the breadcrumbs in single.php file, then simply add the above code in functions.php file (Use child theme always)
Funciona muy bien Gracias, Selvam, the code is placed at the end of functions.php file and before these characters (?>)
Hi jaime
Simply add the above snippet end of function.php just before the php closing tag. Good luck.
This code works well but how can i adjust to include a separator after the last breadcrumb?
Let me post the code once i tested it my local environment. Thanks for your patience.
Awesome, thank you Selvam 🙂
Works great thank you!
Hello, good php snippet for single page but how desactivate it on 404 page ? Thank you.
Thank you very much for this great help. It works fine. I’ve been searching for it for so long. I don’t know why Yoast hasn’t included this function yet.
saved my life bro! Thanks 🙂
it works for me.. Thank you !!!
this code for the custom post type
function adjust_single_breadcrumb( $link_output) {
if ( is_singular( ‘product’ ) AND (strpos( $link_output, ‘breadcrumb_last’ ) !== false )) {
$link_output = ”;
}
return $link_output;
}
add_filter(‘wpseo_breadcrumb_single_link’, ‘adjust_single_breadcrumb’ );
not working 🙁