Title: Set language programmatically
Last modified: August 24, 2016

---

# Set language programmatically

 *  [RaphaelJeger](https://wordpress.org/support/users/raphaeljeger/)
 * (@raphaeljeger)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/set-language-programmatically/)
 * Hi
 * I would like to use your plugin for a project of mine.
    Since I already know 
   the language of each visitor by a plugin I developed, I would like to switch 
   the rest of the site (around my plugin) to this language.
 * Is there any way I can tell your programm programmatically which language to 
   show? I’m already setting the “locale” in WP so my plugin shows the correct language
   so I’d prefer if your plugin could be adapted to use this as well.
 * I don’t mind to put a few lines of code if you think that’s a good idea.
 * Thanks!
    Raphael
 * [https://wordpress.org/plugins/polylang/](https://wordpress.org/plugins/polylang/)

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

 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/set-language-programmatically/#post-6003141)
 * Hi!
 * I am not sure to understand. Maybe you want to control the preferred language
   at first visit to the home page. In that case, the filter [pll_preferred_language](https://polylang.wordpress.com/documentation/documentation-for-developers/filter-reference/#pll_preferred_language)
   should be what you are looking for.
 *  Thread Starter [RaphaelJeger](https://wordpress.org/support/users/raphaeljeger/)
 * (@raphaeljeger)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/set-language-programmatically/#post-6003206)
 * Ok that may work, thanks!
    I just want to set the language programmatically, 
   as I already know which language the user wants from “outside of WP”.
 * Thanks again!

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

The topic ‘Set language programmatically’ 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/)

## Tags

 * [programmatically](https://wordpress.org/support/topic-tag/programmatically/)

 * 2 replies
 * 2 participants
 * Last reply from: [RaphaelJeger](https://wordpress.org/support/users/raphaeljeger/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/set-language-programmatically/#post-6003206)
 * Status: not resolved