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.

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by carlosS-40 5 months, 3 weeks ago.

Assigned support staff: Bigul.

Author Posts
April 26, 2019 at 6:51 pm #3692867

carlosS-40

Tell us what you are trying to do?
I need to know in php code the WPML language format currently in use for a given site in multisite environment.

/?lang=en versus /en/

I know I can decipher the url but would be nice if there is a function or constant that already defines what format is currently in use like I can inquire ICL_LANGUAGE_CODE for the current language.

THanks

April 29, 2019 at 9:26 am #3701567

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve these issues.

Please use the following code to get the Language URL format in use in PHP.

$is_wpml_configured = apply_filters( 'wpml_setting', 0, 'language_negotiation_type' );

This API call will return 1 if the option is *Different languages in directories* and 3 if the option is *Language name added as a parameter*.

Please check the following documentation for more details and let me know your feedback.

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

--
Thanks!

Bigul

May 2, 2019 at 1:44 pm #3724989

carlosS-40

My issue is resolved now. Thank you!