WordPress.org

Support

Support » How-To and Troubleshooting » Error "Warning: Invalid argument supplied for foreach()

Error "Warning: Invalid argument supplied for foreach()

  • I got a multisite.
    When I make a new site, then go to dashboard, I get

    “Warning: Invalid argument supplied for foreach() in /home/user/public_html/wp-includes/query.php on line 1702”

    the line is
    foreach ( $GLOBALS[‘wp_taxonomies’] as $taxonomy => $t ) {

    I tried to add
    echo $GLOBALS[‘wp_taxonomies’];

    but it doesnt print anything

Viewing 3 replies - 1 through 3 (of 3 total)
  • Andrew Nevins
    Forum moderator

    @anevins

    Can you wrap the foreach with

    if ( is_array( $GLOBAL['wp-taxonomies'] )

    Yes that gets rid of the error.
    I’m worried about the cause. Is my DB corrupt?

    This site was copied from my other host, files all copied, import DB, and edited DB for domain names. So I wonder why it gets this error when the old one is fine.

    Reinstall the WP core files. It’s more likely one of them got bunged.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error "Warning: Invalid argument supplied for foreach()’ is closed to new replies.