Yoast 16.2 & 16.3 break Breadcrumbs Schema
-
Hey there,
We noticed that all of our Yoast SEO clients now have hundreds of schema markup errors pertaining to breadcrumb schema. The error is that the breadcrumb schema is missing an item name for the very last breadcrumb item. As an example, it would look like this:
{"@type":"BreadcrumbList","@id":"https://mydomain.com/parent-page/current-page/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"item":{"@type":"WebPage","@id":"https://mydomain.com/parent-page/","url":"https://mydomain.com/parent-page/","name":"Parent Page Title Here"}},{"@type":"ListItem","position":2,"item":{"@id":"https://mydomain.com/parent-page/current-page/#webpage"}}
As you can see, the very last item in the breadcrumb schema has no “name” attribute. I also tried filling out the advanced setting breadcrumb title for the page, which did nothing.
So I dug into the code. From what I can see, the file causing this is:
wordpress-seo/src/generators/schema/breadcrumb.php
Starting in Yoast 16.2, both the format_last_breadcrumb and create_breadcrumb functions changed. From what I can tell, the problem lies in the format_last_breadcrumb function. Starting in 16.2, format_last_breadcrumb does this:
unset( $breadcrumb['url'], $breadcrumb['text'], $breadcrumb['@type'] );
This unsets $breadcrumb[‘text’], and it is never populated again. $breadcrumb[‘text’] is what is populated into the “name” schema attribute above. With no text, it is never populated. If I replace the 16.3 format_last_breadcrumb function with the old 16.1 function, the error is fixed.
Is there something else that I could be doing on my end to fix this? If so, please let me know. If not, please fix this in a future version.
Thank you!
- The topic ‘Yoast 16.2 & 16.3 break Breadcrumbs Schema’ is closed to new replies.