Skip navigation
availability:

WPML Version: 3.2

description:

Returns the current language

type:
filter
category:
Site-Wide Language Information
parameters:
apply_filters( 'wpml_current_language', mixed $empty_value )
$empty_value
(mixed) (Required) 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
hook example usage:

A basic example

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

Creating a shortcode to return the current language

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