WordPress.org

Support

Support » Alpha/Beta » Warning: Invalid argument supplied for foreach() in /wp-includes/canonical.php

Warning: Invalid argument supplied for foreach() in /wp-includes/canonical.php

Viewing 4 replies - 1 through 4 (of 4 total)
  • If i change the canonical.php script by replacing this section line 53:

    foreach ( $wp_query->tax_query as $tax_query )
        $term_count += count( $tax_query['terms'] );

    by this code:

    if (is_tax()) {
       foreach ( $wp_query->tax_query as $tax_query )
         $term_count += count( $tax_query['terms'] );
    }

    The problem is solved…

    Patch needed on WordPress ?

    Mmhh, did not solve all the issue a better patch will be:

    replace:

    foreach ( $wp_query->tax_query as $tax_query )
        $term_count += count( $tax_query['terms'] );

    by:

    foreach ( (array) $wp_query->tax_query as $tax_query )
        $term_count += count( $tax_query['terms'] )

    It works now when i try todisplay my category:

    http://blog.nicolargo.com/category/open-source

    But when i try to get the feed for that category (http://blog.nicolargo.com/category/open-source/feed), i have the following error on the XML file:

    <b>Warning</b>: Invalid argument supplied for foreach() in <b>/srv/d_bilbo/web/blog/wp-includes/canonical.php</b> on line <b>153</b>

    kuchigi rukia

    @kuchigi-rukia

    thank you so muchhhh… nicolargo, you are very genius!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Warning: Invalid argument supplied for foreach() in /wp-includes/canonical.php’ is closed to new replies.
Skip to toolbar