pll_get_current_language

Filter the language before it is set from the content.

Description

apply_filters( 'pll_get_current_language', (bool) $lang ); 

Parameters (1)

0. $lang (bool) => isset( $lang ) ? $lang : false
Language object or false if none was found

Usage

To run the hook, copy the example below.
  1. $lang = apply_filters( 'pll_get_current_language', $lang ); 
  2.  
  3. if ( !empty( $lang ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the pll_get_current_language callback 
  2. function filter_pll_get_current_language( $lang ) { 
  3. // make filter magic happen here... 
  4. return $lang
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'pll_get_current_language', 'filter_pll_get_current_language', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'pll_get_current_language', 'filter_pll_get_current_language', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/frontend/choose-lang-content.php  
  1. return apply_filters( 'pll_get_current_language', isset( $lang ) ? $lang : false );