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?

Related posts

Leave a Reply

1 comment

  1. 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";
    }