• Resolved growme

    (@growme)


    According to Yoast documentation, changing the site language on WordPress or inputting the following code is supposed to change the og: locale

    add_filter('wpseo_locale', function() {
    return 'en_CA';
    });

    After doing that, it doesn’t seem to work. I know I have done this before, and it used to work, but I have done this for two websites, and it did not work. I am not sure if an update happened that broke this, but I have tried multiple languages, including English (UK) and English (Canada), and nothing works. It insists on staying as en_US for some reason.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello @growme,

    Thanks for reaching out about your og:locale. First, your code snippet is not correct. You should add code that looks like this to your theme’s functions.php. Also, there’s a list of valid og:locale but en_ca isn’t. You could try en_gb, though.

    Thread Starter growme

    (@growme)

    I tried the code as well:
    function yst_wpseo_change_og_locale( $locale ) {
    return 'en_CA';
    }

    add_filter( 'wpseo_locale', 'yst_wpseo_change_og_locale' );

    That didn’t work either. So Yoast doesn’t support en_CA even though you can set that as the language for the WordPress site? My code in the initial post did work previously on previous sites, though, which is where my confusion is coming from. Is there no way to set a custom language like en_CA?

    Additionally, that link you sent me says that was the list in 2018. Have there been no updates to supported languages since then?

    • This reply was modified 1 month ago by growme. Reason: Removed unwanted text
    • This reply was modified 1 month ago by growme.
    Plugin Support Maybellyne

    (@maybellyne)

    No, it’s not that Yoast doesn’t support en_CA. Open Graph has a limited list of supported og:locale designations which determines what Yoast SEO supports. The official list used to be on that link but it’s no longer available. The same list is what we published here in which English Canada isn’t part of.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.