I'm using WPML, which has several ways to access the current language.
ICL_LANGUAGE_CODE
if( ICL_LANGUAGE_CODE === 'en' ){
// Do stuff
}
apply_filter( 'wpml_current_language', null )' docs
$lang = apply_filter( 'wpml_current_language', null );
if( $lang === 'en' ){
// Do stuff
}
I can't find any documentation on the ICL_LANGUAGE_CODE.
The apply_filter
has a documentation page, but in my opinion, the readability drops with this.
Are there any obvious drawbacks using one or the other?
Update
I know that I mentioned WPML, but that was to give the question context. This is WordPress-specific and not 3rd party specific. The dynamic could be anywhere in WordPress, in any plugin and/or theme.