WPML
SignaturePHP
apply_filters( 'wpml_current_language', mixed $empty_value )

Description

Returns the current language

Arguments

  • $empty_valuemixedRequired

    This is normally the value the filter will be modifying. We are not filtering anything here so set this to NULL. This for the filter function to actually receive the full argument list

Example Usage

A Basic Example

PHP
$my_current_lang = apply_filters( 'wpml_current_language', NULL );

Creating a Shortcode to Return the Current Language

PHP
function get_language_shortcode() {
    return apply_filters( 'wpml_current_language', null );
}
add_shortcode( 'language', 'get_language_shortcode' );