Support » Fixing WordPress » "Invalid argument supplied for foreach() in" "post.php on line 3588"

  • Why do you all insist on upgrading stuff and then releasing stuff that does not work? It simply makes no sense. So, I just upgraded to WordPress version 3.5 and now the site gives “Invalid argument supplied for foreach() in” blah blah (site directories) “post.php on line 3588”.

    Everything was fine before the update. As a further note, since I’ve noticed LOTS of people having issues, why do you NOT have a simple revert process to remove this stuff when it doesn’t work?

Viewing 13 replies - 1 through 13 (of 13 total)
  • I agree…this is one of the reasons why as a die-hard joomla fan I moved away from joomla because of this and ventured into WordPress…now, as a diehard wordpress fan, with these random updates creating a mess, I’m starting to find myself wondering…hmm…

    I read several posts about putting (array) in front of the variable and while I am clueless about how or why it works, it stopped the darn error messages on my web site! Yay!

     * Builds URI for a page.
     * Sub pages will be in the "directory" under the parent page post name.
     * @since 1.5.0
     * @param mixed $page Page object or page ID.
     * @return string Page URI.
    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;

    Am having the same exact error, help

    there should be a way to revert back to previous WordPress version

    Go to Cpanel
    replace code on 3588 line by following code.
    foreach ( (array)$page->ancestors as $parent ) {

    It will work.

    We has same problem on this site. volunteer in nepal, now it works fine.

    For any users encountering this, Do you still have the issue if you switch to the Default TwentyEleven or TwentyTwelve themes? What if you disable all Plugins?

    You only need to do that temporarily, once you’ve determined what is causing it, you can re-enable them one-by-one to find the exact plugin or theme thats causing your problems.

    Unfortunately, until someone can tell us, and the plugin/theme developer, that a specific plugin or theme is causing the issue, it’s hard for us to recommend a fix.

    I found deactivating the Plugin “Theme My Login” and then Activating it fixed the error message.

    Hope that helps others.

    Well a fix to my particular problem was indeed found by Brassrazoo. Evidently WordPress v3.5 did something funky to the Plugin called “Theme My Login”. I did as Brassrazoo suggested and by simply disabling / re-enabling this particular Plugin the error corrected itself. Thank you Brassrazoo for returning here and sharing the fix that you found!

    After reading all of the problems people are having with this version of WordPress I must say that I would still strongly suggest that the WordPress team develop some non-intrusive way to simply revert back to the previous installation that you had prior to “upgrading” so that when the sh*t hits the fan we aren’t hung out to dry. I’m still not certain that this has corrected all of MY problems with this new version, but it has indeed removed the error from my Admin Panel.

    Thanks again, Brassrazoo!

    i found deactivating “WordPress Shortcodes” plugin fixes it, but you reactivating it wont fix it ! also there is lots of plugins stopped working ! but they dont give any errors !

    Same isssue – but only in one of my WordPress installations (MS using Theme-My-Login, Domain mapping and else). Other WordPress installs that I’ve updated (one is also WP-MS, using Theme-My-Login and Domain mapping as well) weren’t affected!

    So for me it doesn’t seem to be a conflict caused by Theme-My-Login, although this plugin seems to be a candidate, creating a login page and some (backend) redirects…

    In addition, I remarked a ‘headers already sent’ conflict caused by WordPress-Mobile-Pack, which is only used in the former WordPress MS (the one where the error occured). Maybe this gives somebody an idea.

    The foreach (array) Fix worked out … THANKS for saving me!



    Thanks Brassrazoo it worked for me.



    much love to Brassrazoo!


Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘"Invalid argument supplied for foreach() in" "post.php on line 3588"’ is closed to new replies.