Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_determine_locale

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
124      /**
125       * Filters the locale for the current request prior to the default determination process.
126       *
127       * Using this filter allows to override the default logic, effectively short-circuiting the function.
128       *
129       * @since 5.0.0
130       *
131       * @param string|null $locale The locale to return and short-circuit. Default null.
132       */
133      $determined_locale = apply_filters( 'pre_determine_locale', null );
134
135      if ( ! empty( $determined_locale ) && is_string( $determined_locale ) ) {
136           return $determined_locale;
137      }
138
139      $determined_locale = get_locale();
140
141      if ( is_admin() ) {
142           $determined_locale = get_user_locale();