Jump to content

wordpress invalid argument in foreach (line 1702)


Go to solution Solved by sqlnoob,

Recommended Posts

Hi,

 

Some woman did an update for her wordpress website. It may have changed or removed some files. I have no way of determining if that is so, because she can't tell me what update she made.

 

The error I see is the following:

 

Warning: Invalid argument supplied for foreach() in /usr/home/deb27616n2/domains/plezierinleven.nl/public_html/wp-includes/query.php on line 1702

 

This is all I know. She can't tell me anymore and she can't define or tell me what exactly she did and what update she performed. If someone has an easy answer for this, with a quick recode of that function. It be much appreciated, because I don't know where to look for. Whether it is a misreferenced variable, or a missing variable because a file has been deleted I don't know.

 

The error is on line 1702 in the query.php file in the directory of wp-includes:

                foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
                        if ( 'post_tag' == $taxonomy )
                                continue;        // Handled further down in the $q['tag'] block

                        if ( $t->query_var && !empty( $q[$t->query_var] ) ) {
                                $tax_query_defaults = array(
                                        'taxonomy' => $taxonomy,
                                        'field' => 'slug',
                                );

                                 if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {
                                        $q[$t->query_var] = wp_basename( $q[$t->query_var] );
                                }

                                $term = $q[$t->query_var];

                                if ( strpos($term, '+') !== false ) {
                                        $terms = preg_split( '/[+]+/', $term );
                                        foreach ( $terms as $term ) {
                                                $tax_query[] = array_merge( $tax_query_defaults, array(
                                                        'terms' => array( $term )
                                                ) );
                                        }
                                } else {
                                        $tax_query[] = array_merge( $tax_query_defaults, array(
                                                'terms' => preg_split( '/[,]+/', $term )
                                        ) );
                                }
                        }
                }
  • 3 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.