Title: &quot;Detect browser language&quot; sometimes setting NULL language
Last modified: August 22, 2016

---

# "Detect browser language" sometimes setting NULL language

 *  Resolved [dlouwe](https://wordpress.org/support/users/dlouwe/)
 * (@dlouwe)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/detect-browser-language-sometimes-setting-null-language/)
 * **Permalinks:** Post name
    **Static Front Page?** No **Polylang Settings:** -
   The language is set from content -Hide URL language information for default language(
   Checked) -Remove /language/ in pretty permalinks -Detect browser language (Checked)
 * Main symptoms:
    **Block of notices thrown at top of page**
 *     ```
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\choose-lang.php on line 65
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\choose-lang.php on line 52
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\choose-lang.php on line 53
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\frontend-filters.php on line 74
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\frontend-filters.php on line 74
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\choose-lang.php on line 163
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\choose-lang.php on line 171
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\include\links.php on line 148
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\include\links.php on line 148
       ﻿ Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\frontend-filters.php on line 74
       prefix="og: http://ogp.me/ns#">
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\frontend-filters.php on line 74
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\frontend-filters.php on line 74
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\include\links.php on line 148
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\include\links.php on line 148
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\frontend-filters.php on line 74
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\include\plugins-compat.php on line 116
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\include\plugins-compat.php on line 116
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\include\links.php on line 148
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\include\links.php on line 148
   
       Notice: Trying to get property of non-object in \wp-content\plugins\polylang\frontend\frontend-filters.php on line 74
       ```
   
 * **Warning thrown by Events Manager plugin (if present)**
    `Warning: array_key_exists():
   The first argument should be either a string or an integer in \wp-content\plugins\
   events-manager\events-manager.php on line 410`
 * **wp_nav_menu falls back to wp_page_menu**
    wp_page_menu passes $args as an array,
   not object, so this also caused a string of notices from my custom Nav Walker
 * Now the tricky part is I honestly have no idea how this happens “in the wild.”
   It was happening to client intermittently over the course of a couple months,
   always after they updated the site (I think the “intermittent” part is due to
   the W3TC plugin, but the issue still occurs with all plugins disabled) I’m as
   yet unable to duplicate the issue using their same steps; the only way I’ve been
   able to encounter it is by manually changing the value of the “pll_language” 
   cookie to an empty string.
 * Unchecking “Detect browser language” does prevent the issue from happening.
 * [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, 6 months ago](https://wordpress.org/support/topic/detect-browser-language-sometimes-setting-null-language/#post-5572310)
 * Hi!
 * I don’t understand how it is possible taht the language is set to an empty value.
   However, I will try to improve the robustness in V1.6.2 to avoid these ugly notices.
 *  Thread Starter [dlouwe](https://wordpress.org/support/users/dlouwe/)
 * (@dlouwe)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/detect-browser-language-sometimes-setting-null-language/#post-5572461)
 * Thanks for your quick response!
 * As far as I can tell 1.6.2 resolves the issue, though I also don’t really understand
   how it was possible in the first place.
 * In any case, cheers!

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

The topic ‘"Detect browser language" sometimes setting NULL language’ 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
 * 2 participants
 * Last reply from: [dlouwe](https://wordpress.org/support/users/dlouwe/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/detect-browser-language-sometimes-setting-null-language/#post-5572461)
 * Status: resolved