Support » Fixing WordPress » WordPress Update Problems

  • I recently updated my wordpress account to 3.6 and now there is a message on both my admin page and the actual website:

    Warning: Invalid argument supplied for foreach() in /home2/gabay611/public_html/wp-includes/post.php on line 3561

    Warning: Invalid argument supplied for foreach() in /home2/gabay611/public_html/wp-includes/post.php on line 3561

    What is this and how do I get rid of it?

    Thank you,

    Kiara Elmore

Viewing 4 replies - 1 through 4 (of 4 total)
  • Have you tried:

    – deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the default theme to rule out any theme-specific problems.

    resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

    – re-uploading all files & folders – except the wp-content folder – from a fresh download of WordPress. Make sure that you delete the old copies of files & folder before uploading the new ones.

    I solved it by replacing the codes in the post.php file in wp-includes folder:

    Old:

    function get_page_uri($page) {
    $page = get_post( $page );

    $uri = $page->post_name;

    foreach ( $page->ancestors as $parent ) {
    $uri = get_post( $parent )->post_name . “/” . $uri;
    }

    return $uri;
    }

    New:

    function get_page_uri($page) {
    if ( ! is_object($page) )
    $page = get_post( $page );
    $uri = $page->post_name;
    /* Added (array) in the offending line below */
    foreach ( (array)$page->ancestors as $parent ) {
    $uri = get_post( $parent )->post_name . “/” . $uri;
    }

    return $uri;
    }

    This might work for you as well 🙂

    I’d advise against modifying WordPress core files. When you update next time your change will be lost.

    As the topic you link to showed: most people found that a plugin was causing this error.

    You would be better off (and more secure) to fix the real cause of the error.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WordPress Update Problems’ is closed to new replies.