theme_locale

Filters a theme's locale.

Description

apply_filters( 'theme_locale', (bool) $var, (string) $domain ); 

Parameters (2)

0. $var (bool) => is_admin() ? get_user_locale() : get_locale()
The theme's current locale.
1. $domain (string)
Text domain. Unique identifier for retrieving translated strings.

Usage

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

Defined (1)

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

/wp-includes/l10n.php  
  1. $locale = apply_filters( 'theme_locale', is_admin() ? get_user_locale() : get_locale(), $domain );