• Resolved Quentin

    (@egojab)


    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://ww.wp.xz.cn/extend/plugins/polylang/

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Chouby

    (@chouby)

    Did you play with the filter ‘pll_get_post_types’ ?

    Thread Starter Quentin

    (@egojab)

    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

    (@egojab)

    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

    (@chouby)

    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

    (@egojab)

    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

    (@egojab)

    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

    (@chouby)

    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.

    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

    (@chouby)

    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;

    That seems to work just fine! I’ll thouroughly test it later today and let you know if there are any problems.

    I have done some more testing, and it seems to work just fine. Thanks al lot!

    Plugin Author Chouby

    (@chouby)

    OK. I will include the modification in the next release.

    Thread Starter Quentin

    (@egojab)

    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

    (@egojab)

    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

    (@chouby)

    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)

The topic ‘[Plugin: Polylang] Error output before and "Headers already sent" error’ is closed to new replies.