• Resolved nikolagurskiy

    (@nikolagurskiy)


    Good time of day. Not so long ago in the error_log file I found the following error: PHP Warning: Invalid argument supplied for foreach() in /home/itchefru/public_html/wp-content/plugins/google-sitemap-generator/sitemap-builder.php on line 476 What to do? What is the reason and how to fix it?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Anonymous User 9105421

    (@anonymized-9105421)

    I noticed same problem, looks like a small error in the code that (at least for you and me) recently started to generate the PHP warnings:

    PHP Warning: Invalid argument supplied for foreach() in .../wp-content/plugins/google-sitemap-generator/sitemap-builder.php on line 476

    I solved the error by editing line 476 in sitemap-builder.php from:

    foreach($pages as $page) {

    to:

    foreach((array) $pages as $page) {

    After that edit all seems OK for me. I’m using the currently latest Google XML Sitemaps Version: 4.0.8.

    I haven’t had the problem but thanks for the information on how to solve it.-William

    Thread Starter nikolagurskiy

    (@nikolagurskiy)

    <damsko (@damsko)> Thank you for your help. Made all the changes. Error is no longer there. I will keep track on. But I think it’s fixed.

    Anonymous User 9105421

    (@anonymized-9105421)

    Thanks guys for the heads-up that my reply was noticed.

    The Google XML Sitemaps plugin works with the PHP warning but I always prefer having no warnings at all. It is now couple of days since I made the edit and after that no more “Invalid argument supplied for foreach()” warning on load of my sitemap.xml.

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