I am trying to get current language code via ICL_LANGUAGE_CODE
in my plugin
but I can't , it's not defined , the result of this
echo "Code: ".ICL_LANGUAGE_CODE;
is
Code: ICL_LANGUAGE_NAME
When I trying the following
global $sitepress;
$current_language = $sitepress->get_current_language();
echo "Code:". $current_language ;
I get the blank screen.
I don't know in which way I can get it.
In the theme functions.php everything works fine. Thanks.
This constant is deprecated. Please use this instead https://wpml.org/wpml-hook/wpml_current_language/
Full new WPML API is listed here in case if you have more questions https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/
Or you can always ask question at official wpml.org forum :)