Title: Default language based on user language setting
Last modified: January 24, 2017

---

# Default language based on user language setting

 *  Resolved [krystianj](https://wordpress.org/support/users/krystianj/)
 * (@krystianj)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/default-language-based-on-user-language-setting/)
 * Hi,
    It is possible to set default post language based on profile language settings?
 * For example:
    user1 has set languge to English (in Profile) and when he is posting
   the default post language is english. user2 has set language to Deutsch (in Profile)
   and when he is posting the default post language is Deutsch.
 * Can I set this “Polylang – language” (right sidebar when add post) select form
   to language based on user locale?
    -  This topic was modified 9 years, 4 months ago by [krystianj](https://wordpress.org/support/users/krystianj/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [krystianj](https://wordpress.org/support/users/krystianj/)
 * (@krystianj)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/default-language-based-on-user-language-setting/#post-8743541)
 * Hi,
    I know that default language is set up in ‘admin-filter-posts.php’ in line
   219 where: `'selected' => $lang ? $lang->slug : '',`
 * Can I override this in my functions.php ?
 * I want have instead $lang->slug – get_user_locale()
 * Any idea?
 *  Thread Starter [krystianj](https://wordpress.org/support/users/krystianj/)
 * (@krystianj)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/default-language-based-on-user-language-setting/#post-8743853)
 * I don’t know is this best solution but I use javascript for this
 *     ```
       function print_my_inline_script_custom() {
         $lang = get_user_locale();
         $lang_name = explode('_', $lang);
           echo '<script type="text/javascript">
                   document.addEventListener("DOMContentLoaded", function(event) {
                   document.getElementById("post_lang_choice").value="'. reset($lang_name) .'";
                   });
                 </script>';
       }
   
       add_action( 'admin_init', 'print_my_inline_script_custom' );
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Default language based on user language setting’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [krystianj](https://wordpress.org/support/users/krystianj/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/default-language-based-on-user-language-setting/#post-8743853)
 * Status: resolved