Title: [Plugin: Polylang] Error output before  and &quot;Headers already sent&quot; error
Last modified: August 20, 2016

---

# [Plugin: Polylang] Error output before and "Headers already sent" error

 *  Resolved [Quentin](https://wordpress.org/support/users/egojab/)
 * (@egojab)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/)
 * The following error is displayed prior to html output on the page after activating
   the plugin:
 * **Warning:** in_array() expects parameter 2 to be array, null given in **/path/
   to/wordpress/wp-content/plugins/polylang/include/core.php** on **line 330**
 * Also, when unchecking “Hide URL language information for default language” in
   the language settings, the error also includes:
 * **Warning:** Cannot modify header information – headers already sent by (output
   started at **/path/to/wordpress/wp-content/plugins/polylang/include/core.php:
   330**) in **/path/to/wordpress/wp-includes/pluggable.php** on **line 881**
 * And, obviously, no html is output at all.
 * [http://wordpress.org/extend/plugins/polylang/](http://wordpress.org/extend/plugins/polylang/)

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/page/2/?output_format=md)

 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909703)
 * Did you play with the filter ‘pll_get_post_types’ ?
 *  Thread Starter [Quentin](https://wordpress.org/support/users/egojab/)
 * (@egojab)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909705)
 * I didn’t edit any filters or anything.
    This happens immediately after installing
   the plugin fresh. It may be a configuration issue, as I was trying different 
   methods of localizing a blog site and may have not properly went about things.
   I am going to reinstall WP fresh, and try again. I’ll report back if the problem
   still exists.
 *  Thread Starter [Quentin](https://wordpress.org/support/users/egojab/)
 * (@egojab)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909710)
 * Even on a fresh install (WordPress 3.4.1, Polylang 0.8.9) I still receive the
   same error.
    Polylang really looked like the best bilingual plugin, I do hope
   someone has some feedback for this.
 * Also, when I go to “log out” of the admin dashboard, I am greeted with several“
   Headers already sent” errors. And am unable to log out without manually deleting
   cookies.
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909735)
 * Could you look if it comes from a plugin or theme conflict ? Is the error coming
   from the line 330 in 0.8.9 too?
 *  Thread Starter [Quentin](https://wordpress.org/support/users/egojab/)
 * (@egojab)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909739)
 * This is a fresh install. No other plugins and using twenty eleven theme. Also,
   this only happens when logged in as an admin.
 *  Thread Starter [Quentin](https://wordpress.org/support/users/egojab/)
 * (@egojab)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909775)
 * I was mistaken. I did not realize that I had activated another plugin (All In
   One Event Calendar).
    It looks like the problem may be there, due to the way 
   they query posts. Do you have any experience with the two plugins being used 
   together?
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909780)
 * I just downloaded this plugin. The problem comes from the fact that it makes 
   a first query much before the main one which is not expected by Polylang. I will
   try to improve the Polylang robustness to avoid this in the future. However, 
   it is highly probable that much more work is needed to make the two plugins fully
   compatible.
 *  [Arvid](https://wordpress.org/support/users/arvidhahne/)
 * (@arvidhahne)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909795)
 * I have the same problem on my website. I have no plugins activated, but use a
   commercial template that probably does the same. Is there any progress in solving
   the problem yet?
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909800)
 * Could you try the following mofication:
    In polylang/include/core.php at line
   250, replace:
 *     ```
       if (!$this->get_languages_list())
       	return;
       ```
   
 * by:
 *     ```
       if (!$this->get_languages_list() || !did_action('wp_loaded'))
       	return;
       ```
   
 *  [Arvid](https://wordpress.org/support/users/arvidhahne/)
 * (@arvidhahne)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909801)
 * That seems to work just fine! I’ll thouroughly test it later today and let you
   know if there are any problems.
 *  [Arvid](https://wordpress.org/support/users/arvidhahne/)
 * (@arvidhahne)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909804)
 * I have done some more testing, and it seems to work just fine. Thanks al lot!
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909811)
 * OK. I will include the modification in the next release.
 *  Thread Starter [Quentin](https://wordpress.org/support/users/egojab/)
 * (@egojab)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909812)
 * Thanks for your quick response and turnaround. The fix works for me too. Now,
   it looks like I just need to figure out how to filter the events themselves in
   the other plugin.
 * Thanks again.
 *  Thread Starter [Quentin](https://wordpress.org/support/users/egojab/)
 * (@egojab)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909816)
 * Chouby,
 * If you could, do you know of any fixes or workarounds to handle other plugins
   or custom post types that query by wpdb instead of a wordpress post query? This
   is related to the same calendar plugin. Everything seems to work great between
   the two except for the main calendar, which is loaded by ajax for different views,
   and uses wpdb to query the correct events, so it doesn’t filter out the languages,
   and duplicate events are displayed, showing all languages.
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/#post-2909824)
 * Not easy…
 * For AJAX, you must set in either GET or POST pll_load_front=1 and lang=your_language_code.
   If you don’t set lang, the preferred language should be loaded (from cookie or
   browser preference or default language).
 * Then you should modify the query adding the language taxonomy with the current
   language. Since you will need the term_taxonomy_id of the current language, you
   can access it with:
 *     ```
       global $polylang;
       $tt_id = $polylang->get_language(pll_current_language('slug'))->term_taxonomy_id;
       ```
   
 * You can look at polylang/include/core.php lines 487 and below how I added the
   language in existing queries for comments and archives.
    Hope it helps

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/page/2/?output_format=md)

 The topic ‘[Plugin: Polylang] Error output before and "Headers already sent" error’
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/)

 * 17 replies
 * 4 participants
 * Last reply from: [Chouby](https://wordpress.org/support/users/chouby/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-polylang-error-output-before-and-headers-already-sent-error/page/2/#post-2909832)
 * Status: resolved