Skip Navigation

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 2 replies, has 2 voices.

Last updated by Christopher Amirian 1 year, 8 months ago.

Assisted by: Christopher Amirian.

Author Posts
April 17, 2023 at 1:34 pm #13488235

stephenB-35

Find the list of WPML languages

April 17, 2023 at 3:17 pm #13489053

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I created a feature request on your behalf to test the possibility to add a hook when a new language is added to WPML.

I will inform you if there is an update, but there is no ETA for that so I appreciate your patience and rest assured that the matter will be checked and I will tell you the result of the development team's decision.

Thank you.

April 24, 2023 at 3:30 pm #13528617

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi there,

I have an answer from the development team and there is a Hook that is triggered when a new language is added or removed:

https://wpml.org/wpml-hook/wpml_active_languages/

Use it in this way

add_action('wpml_update_active_languages', function($old_active_languages){
	print_r($old_active_languages);
	return $old_active_languages;
});

It gives the list of old languages, for the new list of languages they can use this hook https://wpml.org/wpml-hook/wpml_active_languages/ based on both outputs you can detect which language added/removed.