Support » Plugin: Google XML Sitemap Generator » Invalid argument supplied for foreach()

  • hobbiasztalos

    (@hobbiasztalos)


    Hi

    Type: PHP Warning Line: 94
    File: public_html/wp-content/plugins/www-xml-sitemap-generator-org/code/renderers/xmlRenderer.php

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author XmlSitemapGenerator

    (@xmlsitemapgenerator)

    Thanks.
    I will investigate this and get back to yo shortly.
    You can suppress these warnings by disabling debug messages.
    https://www.greengeeks.com/tutorials/article/disable-wordpress-php-error-messages/

    Plugin Author XmlSitemapGenerator

    (@xmlsitemapgenerator)

    Hello.

    Sorry for the delay.
    Please could you check if this is still happening in version 2.0.1?
    Thanks

    Thread Starter hobbiasztalos

    (@hobbiasztalos)

    Yes I am using version 2.01. About 1000-1500 such error entries are generated per day. Automatic updating is turned on.
    The wp version number is 5.7

    cmm

    (@cmoschella)

    I am seeing this error in my logs as well…WP version 5.7 and plugin version 2.0.1

    PHP Warning: Invalid argument supplied for foreach() in /var/www/wordpress/wp-content/plugins/www-xml-sitemap-generator-org/code/renderers/xmlRenderer.php on line 94

    • This reply was modified 6 months, 1 week ago by cmm.
    Thread Starter hobbiasztalos

    (@hobbiasztalos)

    cmm

    Thank you for confirming this error. This already proves that this is not a unique error. Now it would only be good if the repair was done.

    Hello,
    i am using the plugin too.
    I also confirm on my site I get many identical errors in my error_log_php.

    Ron Dowd

    (@rondowd)

    Hi, I’ve just installed the plugin and am getting the same error. You can see it in the XML here.

    Hello,

    you can hotfix the file wp-content/plugins/www-xml-sitemap-generator-org/code/renderers/xmlRenderer.php line 94 – function renderImages just add isset condition

    https://i.imgur.com/NN4gYqL.png

    private function renderImages($images)
    		{
    			if (isset($images)) {
    			
    				foreach( $images as $image ) 
    				{
    					echo '<image:image>'  ;
    					echo '<image:loc>'  . $image->location . '</image:loc>';
    					if (!empty($image->caption)) {echo '<image:caption>' . $image->caption . '</image:caption>';}
    					if (!empty($image->title)) {  echo '<image:title>' . $image->title . '</image:title>';}
    					echo "</image:image>\n" ;	
    				}
    
    			}
    		}
Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.