WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/locale

An example of changing the locale language, based on a parameter pass on the url.

<?php
add_filter( 'locale', 'set_my_locale' );
function set_my_locale( $lang ) {
  if ( 'gl' == $_GET['language'] ) {
    // set to Greenlandic
    return 'ka_GL';
  } else {
    // return original language
    return $lang;
  }
}
?>
This page is marked as incomplete. You can help Codex by expanding it.