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

    (@chouby)

    Hi!

    This should come from a theme or plugin conflict. Try switching to Twenty Twelve and de-activate all your plugins except Polylang. Then switch back to your theme and activate your plugins one by one untile your reproduce the conflict.

    Hi Chouby, I’m getting the same exact error:

    Warning: Illegal string offset 'taxonomy' in /home/kaldimar/public_html/wp-content/plugins/polylang/frontend/frontend.php on line 88

    In my case it only goes away by disabling the Cherry Plugin. Sadly, this is required for the theme to work, so disabling it is not an option and at the same time we’re relying on Polylang for internationalization. Please advise, thanks.

    FWIW, in line 87 the foreach is looping through an array which, for my home page, has four items, three of them arrays in turn and one (the second) is a string “AND”, this string is the one causing the warning.

    A type check before evaluating the taxonomy index against ‘post_format’ may solve this?

    Thread Starter Mironomadic

    (@mironomadic)

    Hi Chouby!

    Thanks for the reply but the error appeared after updating to wordpress 4.1

    There was no recent addition of plugins which produced the error, however, i did deactivate all and was unable to reproduce the conflect.

    Please advice, thanks.

    Hi,

    I’m having exactly the same problem here. It appeared after WordPress update to 4.1.

    I suppose it is due to the changes that were done to the taxonomy queries for 4.1…

    I made a temporary fix to my site like follows. (NB: this is not a correct fix, and something might still be broken. This only removes the warning that is being displayed on the site, until the plugin author can provide a real fix.)

    Edit frontend/fronted.php and change the section:

    $has_tax = false;
    		if (isset($query->tax_query->queries))
    			foreach ($query->tax_query->queries as $tax)
    				if ('post_format' != $tax['taxonomy'])
    					$has_tax = true;

    to the following:

    $has_tax = false;
    		if (isset($query->tax_query->queries))
    			foreach ($query->tax_query->queries as $tax)
    				if( is_array( $tax ) && array_key_exists( 'taxonomy', $tax ) ) {
    					if ('post_format' != $tax['taxonomy'])
    						$has_tax = true;
    				}

    Plugin Author Chouby

    (@chouby)

    Hi!

    This is a minor warning which in my opinion hasn’t any side affect. So your proposed fix should work. If errors are displayed on screen, just set WP_DEBUG to false in wp-config.php.

    Nevertheless, I would be happy to know more about plugins or themes at the origin of this conflict.

    After some search, I found out that it may be related to the new possibility to use nested tax queries in WP 4.1. But I would be very surprised that a plugin or theme does already use this new feature. Do all of you use the Cherry plugin? Or could you test if there is some other conflict source?

    Hi,

    This error comes from the new ‘relation’ query parameter that’s been introduced by WP 4.1.

    Here’s an excerpt from the codex:

    Taxonomy Parameters
    Show posts associated with certain taxonomy.
    
    {tax} (string) - use taxonomy slug. Deprecated as of Version 3.1 in favor of 'tax_query'.
    tax_query (array) - use taxonomy parameters (available with Version 3.1).
       relation (string) - The logical relationship between each inner taxonomy array when there is more than one. Possible values are 'AND', 'OR'. Do not use with a single inner taxonomy array.
          taxonomy (string) - Taxonomy.
          field (string) - Select taxonomy term by ('term_id'(default), 'name' or 'slug')
          terms (int/string/array) - Taxonomy term(s).
          include_children (boolean) - Whether or not to include children for hierarchical taxonomies. Defaults to true.
          operator (string) - Operator to test. Possible values are 'IN'(default), 'NOT IN', 'AND'.
    
    Important Note: tax_query takes an array of tax query arguments arrays (it takes an array of arrays). This construct allows you to query multiple taxonomies by using the relation parameter in the first (outer) array to describe the boolean relationship between the taxonomy arrays.

    So, any plugin or theme could use this functionality now. The Warning appears because the ‘relation’ parameter is not an array, it is a simple string.

    I think that the plugin using this on my site is Views by onTheGo Systems.

    I also have this error:
    Warning: Illegal string offset ‘taxonomy’ in /home/xxx/wp-content/plugins/polylang/frontend/frontend.php on line 88

    I am using ‘Real Homes’ theme.

    Will there be a fix to thus issue?

    Plugin Author Chouby

    (@chouby)

    The development version (1.6.2.3) introduces a quick fix
    https://downloads.www.ads-software.com/plugin/polylang.zip

    @alain
    Your fix works good. Thank you.

    I had this issue after I moved whole site to another server.
    Both differ in PHP version. Old one runs PHP 5.3.27 and new one 5.4.24. Maybe this is a source of problems?
    Recently I have a lot off new issues of this kind when upgrading PHP on my sites.

    BTW Thank you Chuby for this great plugin ??

    Hi, I am using ‘Real Homes’ theme as well.
    I upload the the version (1.6.2.3) and English page is fine.
    But it still having problem “error:
    Warning: Illegal string offset ‘taxonomy’ in /home/xxx/wp-content/plugins/polylang/frontend/frontend.php on line 88
    ” with my Chinese Page.

    Please advice, thanks.

    Plugin Author Chouby

    (@chouby)

    Hi!

    Strange. Could you copy-paste the line 88 here?

    Thanks for reply, the code as below:
    // to avoid conflict beetwen taxonomies
    // FIXME generalize post format like taxonomies (untranslated but filtered)
    $has_tax = false;
    if (isset($query->tax_query->queries))
    foreach ($query->tax_query->queries as $tax)
    if( is_array( $tax ) && array_key_exists( ‘taxonomy’, $tax ) ) {
    if (‘post_format’ != $tax[‘taxonomy’])
    $has_tax = true;
    }

    @alain you got it right, in 4.1+ instead of $query->tax_query->queries being purely an array of arrays, it has one item of type string, in my case “AND”. Not a good design in my opinion. Type checking inside the foreach loop may be enough to prevent the notice being fired.

    @tom it shouldn’t be related to PHP versions but rather in your previous server the error reporting was set to Off and in the new one all notices are exposed. If your site is live I’d suggest you to turn error reporting off for good measure.

Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘Warning: Illegal string offset 'taxonomy' error!’ is closed to new replies.