skip to Main Content

I am unable to update the sidebar on my WordPress website (Appearance > Widgets). Everytime I try, I receive the message:

"There was an error. Cannot read properties of undefined (reading ‘map’)"

I don’t where to begin debugging this. I disabled all the plugins and changed my theme, but I still receive the same message.

Does anyone know what this message means or where I can start looking for a solution?

6

Answers


  1. The problem is in the widgets themselves.
    WordPress cannot process some of the already used widgets and shows the error.
    The easiest solution I’ve found is to to switch to the former Widgets Page and remove all widgets there. Then switch back to the new Widgets Block editor and recreate all the sidebars from scratch.

    Login or Signup to reply.
  2. As suggested by @Tatiana K switching back to the original Widget editor, deleting existing widgets and reverting back to the new Widget editor solved it for me.

    You can disable the Widget Editor by using these filters :

    // Disables the block editor from managing widgets in the Gutenberg plugin.
    add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' );
    // Disables the block editor from managing widgets.
    add_filter( 'use_widgets_block_editor', '__return_false' );
    
    Login or Signup to reply.
  3. Solved.
    I had the same problem. The editor didn’t work and displayed the same errors.
    I tried the same things as you did, enabling, disabling, uninstall, reinstall…

    But I found the problem was not on Gutenberg or plugins. Somehow the rest API calls the editor and the file to be edited, it doesn’t call the right things.

    I fixed it by changing nginx server config.
    I think the problem is with the server setup.

    I am on nginx/ubuntu wordpress multisite, and have the working(no errors) config block as:

    # Single site setup
     if (!-e $request_filename) {
        rewrite ^.* /index.php break;
     }
    
    # Multisite Subdomain setup
        if (!-e $request_filename) {
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;
        rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
        rewrite ^/[_0-9a-zA-Z-]+(/.*.php)$ $1 last;
    }
    

    The first block was commented out initially with the problems. I revive the first block, and the editor works like a charm.
    This thing happened before whenever I changed the server from Apache to nginx or change the configurations.
    As I am a hobbiest, not a non-tech person, I cannot explain why, but it worked for me. Hope this helps.

    Login or Signup to reply.
  4. A simple solution is to go to Customize option on the Blog page. Select the pen logo (edit option) on the widget you want to delete. Simply delete. That’s it.

    Login or Signup to reply.
  5. I was having this issue as well. I installed the Classic Widget plugin then activated it. I went to the widget that was giving me the problem and edited it. Saved it, no error. Hope this helps!

    Login or Signup to reply.
  6. I had a similar issue with WordPress "Cannot read properties of undefined (reading ‘blocks’)

    It occurred to me that there might be some residual or corrupt stuff in the Inactive widgets. However, as long as the error was there, the Inactive Widgets zone appeared empty (I was sure it wasn’t and I could see content in the footer widgets when using the customise feature, but the actual appearance > widgets page showed only errors).

    So I installed and activated the classic widgets plugin. In the classic interface there is a button "Clear Inactive Widgets"

    After I did that, I deactivated the classic widgets plugin and switched back to the block widgets section and all the widgets had re-populated correctly and I could edit the widgets again 🙂

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search