Title: [Plugin: Polylang] Start page automatically changes language (not wanted&#8230;)
Last modified: August 20, 2016

---

# [Plugin: Polylang] Start page automatically changes language (not wanted…)

 *  [blablubb](https://wordpress.org/support/users/blablubb/)
 * (@blablubb)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-polylang-static-page-changes-language/)
 * I have a quite weird bug to report, so far I could not figure out why this would
   happen.
    Specs: – I use the Graphene theme – I use polylang v. 0.6.1 – I use 
   two languages (English and German), English is default – I set the option to 
   show a static page instead of the recent posts as the start page – My English
   static start point is the page “my_homepage/home” – My German static start point
   is the page “my_homepage/startseite”
 * Problem:
    Sometimes (Could not really reproduce it clearly until now…) the German
   start page is automatically (!) set to English (Just by switching the language
   and browsing between pages). I then have to set it back to German by hand (which
   is extremely annoying).
 * I cannot do much to prevent this. It happened in different situations (Searching
   and switching the language, changing links by hand and switching the language),
   but I did not find a clear pattern yet.
    Any ideas how to prevent this? I always
   have to switch the language of the German start page back to German, otherwise
   it appears within the English pages.
 * So far this problem only appeared for the start page.
 * Is this a problem of my page structure or a bug?

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

 *  [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-polylang-static-page-changes-language/#post-2523856)
 * I downloaded the Graphene theme and made tests with it. Browsed my test site,
   made search… in default and non default language. Sorry, but I did not reproduce
   any undesired language switch.
 * However I detected a big incompatibility between Polylang and Graphene when requesting
   a non existing page. The redirection setup on Error 404 by the Graphene theme
   either loops or breaks the language detection…
 *  Thread Starter [blablubb](https://wordpress.org/support/users/blablubb/)
 * (@blablubb)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-polylang-static-page-changes-language/#post-2524068)
 * Hm… I still have the problem though…
    Anyway, thanks for the help. Are there 
   any code parts where polylang automatically changes the language of a page (Or
   is the page language set dynamically anyway?)? If this can be easily listed it
   would be nice if you could point out the code parts – if it takes too much time
   then don’t; eventually I will find the problem – I hope 😉 If I know in which
   cases automatic language changes are done I could maybe find a way to reproduce
   the problem better… In any case I will test more and report back.
 *  Thread Starter [blablubb](https://wordpress.org/support/users/blablubb/)
 * (@blablubb)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-polylang-static-page-changes-language/#post-2524070)
 * The problem is definitely connected to the problem of requesting non-existing
   pages. If I do that it will always happen.
    Can you maybe describe what you mean
   by “breaks the language detection”? I still don’t really understand how it can
   happen that the language of the page is just changed. I mean there must be some
   table somewhere that states clearly which page id has which language (Or each
   page remembers it…). It should not be possible to just change that automatically(
   That’s my feeling, I don’t really know how the plugin is implemented…).
 * This might also be interesting: Once the language of the page was changed the
   translation of the page points to itself.
 * EN page id = 2, DE page id = 14
 * OK:
    DE(id = 14) -> EN id = 2, EN(id = 2) -> DE id = 14
 * After automatic change:
    DE set to EN(id = 14) -> DE id = 14, EN(id = 2) -> DE
   id = 14
 * So the German page changes its language to English and points back to itself 
   for the German translation while the English page did not change (it still points
   correctly to 14, the problem is just that the language of 14 was changed to English…).
 *  [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-polylang-static-page-changes-language/#post-2524190)
 * The way the language detection works much depends on the page requested.
 * For posts, pages, categories and post tags, Polylang just stores the language
   in the database.
 * For archives, the language is added to the URL (Polylang modifies all links to
   archives to add the language code in the link).
 * For the home page and 404, the language is either set by a cookie or the browser
   preference or the default langage.
 * For the search result, the language is added to the URL. Polylang does modifies
   the search form. But it does not modify the direct request done in 404.php by
   the Graphene theme. So it does not know which language to load.
 * I did not make deep tests but the following modifications may help.
    Edit graphene/
   theme.php and replace the line 13
 *     ```
       $redirect_location = get_home_url().'?s='.$search_term_q.'&search_404=1';
       ```
   
 * by
 *     ```
       $lang = reset(explode('_', get_locale()));
       $redirect_location = get_home_url().'?lang='.$lang.'&s='.$search_term_q.'&search_404=1';
       ```
   
 *  Thread Starter [blablubb](https://wordpress.org/support/users/blablubb/)
 * (@blablubb)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-polylang-static-page-changes-language/#post-2524203)
 * Thanks a lot! That seems to be working.
    If the problems appears again I will
   try to report the steps how to reproduce it clearly 🙂
 *  [machwi](https://wordpress.org/support/users/machwi/)
 * (@machwi)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-polylang-static-page-changes-language/#post-2524278)
 * i am using qtranslate plugin. have 2 language. default language is ka_ge, but
   at first run of start page, it changes automatically ?lang=en. if i put again
   my site homepage url it opens correctly. what’s wrong?
 *  [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-polylang-static-page-changes-language/#post-2524281)
 * [@machwi](https://wordpress.org/support/users/machwi/) You wrote you are using
   qTranslate but here the topic is tagged as Polylang (not qtranslate) so you won’t
   find qTranslate users reading this. It would be better to post on the [qTranslate Forum](http://www.qianqin.de/qtranslate/forum/).

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

The topic ‘[Plugin: Polylang] Start page automatically changes language (not wanted…)’
is closed to new replies.

 * 7 replies
 * 3 participants
 * Last reply from: [Chouby](https://wordpress.org/support/users/chouby/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-polylang-static-page-changes-language/#post-2524281)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
