• nicolargo

    (@nicolargo)


    Hi, i use the lastest alpha version of WordPress (3.1 build 15672).

    When i try to access to my categories or tags pages (exemple: https://blog.nicolargo.com/category/open-source), i have the following error:

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

    Any idea ?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nicolargo

    (@nicolargo)

    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…

    Thread Starter nicolargo

    (@nicolargo)

    Patch needed on WordPress ?

    Thread Starter nicolargo

    (@nicolargo)

    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:

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

    But when i try to get the feed for that category (https://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>

    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.