UPDATE: This has been fixed with the Genesis 2.1 update and is no longer required. As always, it’s recommended that you update to the latest Genesis version.
Yoast recently announced a major update to their very popular Yoast WordPress SEO Plugin, an update which is considered “probably the single biggest update to our WordPress SEO plugin since its initial release.” That may be great news, but if you’re a fan of the Genesis Framework by StudioPress you may run into some issues using the default Genesis Breadcrumbs.
The new update to the Yoast WordPress SEO plugin (version 1.5.x.x) overrides the Genesis breadcrumbs completely (we’ve only tested with Genesis 2.x.x) . There is a setting in the Yoast WordPress SEO admin panel which gives you the option to “Enable Breadcrumbs”:
In previous versions, it worked the way it should. If the box was unchecked, the default Genesis breadcrumbs would display. If the box was checked, the Yoast WordPress SEO breacrumbs would display. But since the update, the Yoast breadcrumbs will show if the “Enable Breadcrumbs” box is checked but no breadcrumbs show if the box is unchecked.
Before discussing how we fixed this issue, you might be wondering “why not just use the Yoast breadcrumbs?” We’ve added some additional functionality to the Genesis breadcrumbs using Genesis hooks and CSS and we want to keep these changes, so we want to use the Genesis breadcrumbs rather than the Yoast breadcrumbs.
If you’re not making any major changes to your breadcrumbs, take a look at this post as another option.
We won’t get into what’s causing this issue or who should be responsible for fixing this (Yoast or StudioPress?). You can read more about that here, along with some fixes that may be useful for non-Genesis themes:
https://github.com/Yoast/wordpress-seo/issues/816
https://wordpress.org/support/topic/breadcrumbs-function-exists-even-if-toggled-off
Based on this information, there was a suggestion that removing/commenting out these lines from the Genesis file /genesis/lib/functions/breadcrumb.php around line 61 would restore the Genesis breadcrumbs:
[gist id=”1027fdf9da59a829c31d” file=”genesis-breadcrumbs-yoast-section.php”]
That does work, but there are a couple of issues with that:
You should never modify the core files. The next update will overwrite any changes you’ve made.
If I want to switch to the Yoast breadcrumbs, I’d prefer to do it through the admin settings than to have to go back into the code and modify things.
Our Solution For Showing The Genesis Breadcrumbs:
So our solution was to replace the default Genesis breadcrumbs with our custom Genesis breadcrumbs, removing the code listed above. But first we added a conditional check, which would check to see if the Yoast WordPress SEO plugin exists, and if it does is the “Enable Breadcrumbs” box checked?
If it’s checked, we’ll use the Yoast breadcrumbs. If it’s not checked, we’ll use our modified breadcrumb function (which is a copy of the default breadcrumb function minus the Yoast code).
And here’s the final code, which we add to our child theme’s function.php file:
[gist id=”1027fdf9da59a829c31d” file=”genesis-yoast-breadcrumb-fix.php”]
Leave a Reply