简体   繁体   中英

Changing Wordpress locale as set by yoast SEO plugin

My WordPress site is based in Great Britain. I was able to change the html lang -attribute from en-US to en-GB , however when I view my source code the og:locale attribute of open graph displays as en-US , it is generated by yoast SEO plugin. Is there a way to change locale to en-GB ?

From the documentation :

wpseo_locale (string)

Allows changing the locale used in the opengraph set (and possibly in other locations later on).

Here's a specific example of how someone else solved it in functions.php:

add_filter('wpseo_locale', 'override_og_locale');
function override_og_locale($locale)
{
    return "en_GB";
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM