How to fix 'HOME' becoming '家' in All in One SEO's structured breadcrumbs

The WordPress plugin All in One SEO outputs structured markup for breadcrumbs.
The output source is roughly in this "JSON-LD" format:
<script type="application/ld+json" class="aioseo-schema">
{"@context":"https:\/\/schema.org","@graph":[{"@type":"BreadcrumbList","@id":"http:\/\/blog.knis.jp\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"http:\/\/blog.knis.jp\/#listItem","position":1,"name":"\u5bb6","item":"http:\/\/blog.knis.jp\/","nextItem":"http:\/\/blog.knis.jp\/#listItem"},{"@type":"ListItem","@id":"http:\/\/blog.knis.jp\/#listItem","position":2,"name":"title",・・・
</script>
When you run this through Google's Rich Results Test,
it shows "家", which is ridiculous!

It seems the translation of "HOME" is "家", which is uncool, so let's fix it.
Since I couldn't find any settings related to this in All in One SEO,
Add the following to functions.php.
//AIOSEO fix for breadcrumbs becoming "家"
add_filter( 'aioseo_schema_output', 'aioseo_filter_schema_output' );
function aioseo_filter_schema_output( $graphs ) {
if($graphs[0]['itemListElement'][0]['name'] == '家'){ //When the first name in $graphs is "家"
$graphs[0]['itemListElement'][0]['name'] = 'HOME'; //Replace with "HOME"
}
return $graphs;
}
"HOME" should be the first item in the breadcrumbs.
We check the first value of the breadcrumbs and replace "家" with "HOME" if found.
If future updates change "家" to something like "お家", please let me know in the comments.




If this was helpful, we appreciate your support!
Any support received will be used for childcare.
Or support us by buying something from the buttons below
(You don't have to buy the linked product.)
Amazon
楽天市場
Yahoo!ショッピング
PR