Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 7 replies, has 2 voices.

Last updated by Murat Gumrukcuoglu 3 years, 10 months ago.

Assisted by: Yvette.

Author Posts
October 1, 2021 at 8:34 am #9701519

Murat Gumrukcuoglu
<meta property="og:locale" content="en_US" />

In WordPress under general option Site language shows that this setting should be changed by with WPML.
in WPML default language is english with language code en_UK.

So question is why it's showing wrong code?

Schermafbeelding 2021-10-01 om 10.33.30.png
Schermafbeelding 2021-10-01 om 10.32.09.png
Schermafbeelding 2021-10-01 om 10.30.17.png
October 1, 2021 at 1:47 pm #9703877

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Paris (GMT+02:00)

Hello

I´ve been assigned to your issue.

1. Temporary Access to your system
Please provide access to your system (wp-admin and ftp) so that I can further investigate this particular problem. The fields to provide this data are included in a private section that I will open for your next response. You can find it above the comments area. The information in this private section is only visible between WPML Support and you.

2. Is this a development or live site?

3. I understand that you are expecting to see the locale for GB English - right?

October 5, 2021 at 9:06 am #9721855

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Paris (GMT+02:00)

Hello

How/where can I see this "org: locale" meta value? And would you know which plugin/theme template is generating this?

The short answer to your question could be that code that is generating this meta property is not passing through our filters and is therefore seeing the Wordprerss locale as if our plugins were not installed.

So, we may be looking at a compatibility issue.

October 5, 2021 at 10:05 am #9722431

Murat Gumrukcuoglu

Hallo yvette,

this is coming from yoast: hidden link
as stated there it takes values based on WordPress language.

October 6, 2021 at 7:22 am #9729839

Murat Gumrukcuoglu

Hallo Yvette,

i see now what is the issue:
default locale is indeed used by Yoast but the values for that are incorrect:
hidden link

although same field is used for html lang and for that field those values are correct.
hidden link.

right now i'm making own fix based on mapping default locale to Yoast og:locale

October 6, 2021 at 7:48 am #9730015

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Paris (GMT+02:00)

Hello

Thank you for the info. I was testing your site with various languages yesterday and I was surprised to find that with FR language, the og:locale was correct (see image).

Yet, with the various EN versions, the og:locale was as you had described. This led me to do more digging and I found the following older ticket that may still apply in your case:
https://wpml.org/forums/topic/language-code-in-html-and-in-meta-property-for-a-personalized-language-created/#post-674206

On short, the code in the plugin is doing a kind of validation against it´s own list of locales. If the locale is not valid, it will set it to a default value - perhaps the WordPress default in the database (not the WPML override).

However, this morning, the same FR site is now returning og:locale of nl_NL so I wonder if you have been doing your own testing/changing.

In any case, I offer this as input to what might be happening. We can replicate this on a sandbox site and escalate if you feel this is a WPML bug. Please let me know and I will prep a sandbox site and ask you to upload and configure WP SEO to show the same issue there.

October 6, 2021 at 9:23 am #9730787

Murat Gumrukcuoglu

Hallo Yvette,

it will be nice to have additional field within WPML like Default lang( which will be used for html lang tag) and Default locale which can be used for locale.

yes i was testing if we can override Yoast:

function yst_wpseo_change_og_locale( $locale ) {
    return 'nl_NL';
}

add_filter( 'wpseo_locale', 'yst_wpseo_change_og_locale' );