Support » Plugin: Gutenberg » error Warning: Invalid argument supplied for foreach() in

  • elesoy

    (@elesoy)


    After last update an error occured: Warning: Invalid argument supplied for foreach() in…
    I’ve found that line in the file blocks.php: foreach ( $block[‘innerContent’] as $chunk ) {
    My home page was “moldered away” )
    A deactivated and deleted Gutenberg, then downloaded again – didn’t help.
    Please, could you help to resolve this problem?

    • This topic was modified 5 months ago by  elesoy.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Are you using any other page builder plugins? Do you have other plugins which provide you with Custom Blocks installed?
    There was a new Gutenberg version (4.5) released on Nov 20th. Do you still see the error message?
    It might help if you provide a bit more information regarding your site.
    Also, WordPress Contributors maintain a Health Check & Troubleshooting plugin that will allow you with tracking this down.
    For instance, it will allow you as the administrator to switch off plugins one at a time, without affecting your live site. This way you can make sure there isn’t a conflict with another plugins causing this error message.

    Let me know how this goes:-)

    Hello, thank you very much for your very kind response and helpful information. A week ago I tried to resolve this problem but finally deactivated and deleted Gutenberg. At present site functions with classic editor perfectly. And I’ve already got used to it 🙂
    Best regards and nice day

    You are welcome. I am glad to read that the Classic Editor works for you on your site.

    I’m having the same problem.

    Warning: Invalid argument supplied for foreach() in /var/www/puska4.ru/wp-content/plugins/gutenberg/lib/blocks.php on line 150

    The problem in type of $block[‘innerContent’] variable:
    foreach ( $block['innerContent'] as $chunk )

    Result of var_dump ($block[‘innerContent’]):
    array(1) { [0]=> string(28) "

    This code is hide the error:

    if (is_array($block['innerContent'])) {
    	foreach ( $block['innerContent'] as $chunk  ) {

    It’s look like $block[‘innerContent’] sometime was return not array.

    • This reply was modified 4 months, 2 weeks ago by  deynekin.
    • This reply was modified 4 months, 2 weeks ago by  deynekin.

    Hello, deynekin. Thanks a lot! This code should help. I will definitely try after downloading plugun again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.