Support » Fixing WordPress » Error in widgets with new WordPress Version 5.8 – wp_enqueue_script() and wp

  • Hello, i currently can’t use the Widget section after updating to 5.8. As you can see in the following image, i got several error messages and infinite loading of the new section.
    https://imgur.com/a/dNRRag7

    Using the debug function in wp-config drops the following message into my logfile:
    Notice: wp_enqueue_script() wurde <strong>fehlerhaft aufgerufen</strong>. "wp-editor" script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets). Weitere Informationen: <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress (engl.)</a> (Diese Meldung wurde in Version 5.8.0 hinzugefügt.) in /var/www/html/wp-includes/functions.php on line 5535

    I also found this https://make.wordpress.org/core/2021/06/29/block-based-widgets-editor-in-wordpress-5-8/ but it doesn’t help a lot …

    Does anyone has an idea or clue what i can do next to get this working?

    Thanks in advance

    • This topic was modified 9 months, 4 weeks ago by Jan Dembowski.

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

Viewing 15 replies - 1 through 15 (of 20 total)
  • Hi, @dphi

    Have you tried installing the Classic Widgets plugin to disable the new widgets screen in 5.8, and revert back to the original Widgets screen? It might fix your issues:
    https://wordpress.org/plugins/classic-widgets/

    PS: Always make sure you have a backup. 🙂

    Kind regards!

    Thread Starter dphi

    (@dphi)

    Hi @vladytimy

    i just found another solution to get the old widget section back – I haven’t tested the plugin yet because we are using such a bunch of plugins and i don’t won’t to overload my wordpress instance 🙂

    I have added this inside my function.php (inside my Theme):

    // deactivate new block editor
    function phi_theme_support() {
        remove_theme_support( 'widgets-block-editor' );
    }
    add_action( 'after_setup_theme', 'phi_theme_support' );

    But is their any solution to solve the issues to use the new block editor? Or is this currently the only way to get the widgets working by deactivating this new function?

    Hi!

    I’m glad you don’t settle for the easy solution of patching a conflict by giving up on a new feature. If you want to use the new Block Widgets screen, you need to do a little more debugging. Your theme (most probably) or one of your plugins conflicts with the new widgets editor.

    In order to see what is the source of the problem, please attempt to

    • disable all plugins
    • and

    • switch to a default theme (Twenty Twenty-One)

    If the problem goes away, enable the plugins one by one to identify the source of your troubles.

    As an alternative, if you want to make these changes only for your eyes, without affecting normal visitors to your site, install Health Check Plugin

    1. Under Tools > Site Health, on the Troubleshooting tab, click on the Enable Troubleshooting Mode button to disable all plugins and change the theme to a default one (just for yourself, while you’re still logged in).

    2. Then, by using the options displayed at /wp-admin, you can turn on/off plugins and themes, one at the time and check what plugin is the cause of your problem.

    3. Don’t forget to Disable Troubleshooting Mode when you’re done. And you can also uninstall the Health Check Plugin to keep the plugin list clean.

    After you see where the issue comes from, you should contact that theme/developer author and ask them to update their product.

    I understand this can take some time, but this way, you can make use of the latest features and also help others by asking the developers to update their product.

    Kind regards!

    Thread Starter dphi

    (@dphi)

    Hello @vladytimy ,

    thanks for your detailed answer. I already know that the issue is coming from out theme (in the most cases). The problem is, that this theme was created by an agency that isn’t reachable anymore. The theme is discontinued. So i’m trying to keep it up-to-date on my own.

    I just found out that the widgets are registered inside my theme at this function

    function register_cozy_widget() {
        register_widget( 'WT_Cozy_Widget_Info' );
        ...
        unregister_widget('WP_Widget_Text');
        register_widget( 'WT_Widget_Cozy_Text' );
        register_widget( 'WT_Cozy_Widget_Side_Info' );
        register_widget( 'WT_Widget_Cozy_Image' );
        ...
    }
    add_action( 'widgets_init', 'register_cozy_widget' );

    I also found the specific class where one of these widgets are clarified. But i do not know where to have an eye on – what has changed/what i need to modify…

    remove_theme_support( ‘widgets-block-editor’ );

    worked for me too thanks. A third party theme which is slow to update to deal with issues and which you have no control over.

    Personally I despise the new Gutenberg editor anyway, it is the worst block editor solution I have ever seen but it seems the only place that WordPress out any effort into these days. But some people might love it, yes I can use classic editor or theme’s own (far better) block editor.

    Thanks @dphi, this worked for us too:

    // deactivate new block editor
    function phi_theme_support() {
        remove_theme_support( 'widgets-block-editor' );
    }
    add_action( 'after_setup_theme', 'phi_theme_support' );

    We too despise the new Gutenberg editor, we can´t underestand why we have to be obligated to use it, when we don´t underestand it and do not like it at all.

    Thanks for the solution (functions.php).
    Worked for me too 👍

    The fatal error scared the heck out of me 🙂
    I agree with Ibiza69; I hate Gutenberg.
    You won’t believe how many websites use plugins and php to bypass Gutenberg.
    Even more than actual Gutenberg users !!

    abhinavsood16

    (@abhinavsood16)

    This issue is faced when your wordpress updates to 5.8 version.
    There is a simple solution to this. You only have to install & activate “Classic Widgets” plugin. It would resolve the issue.

    @dphi thanks

    // deactivate new block editor
    function phi_theme_support() {
        remove_theme_support( 'widgets-block-editor' );
    }
    add_action( 'after_setup_theme', 'phi_theme_support' );

    this helped me out.

    // deactivate new block editor
    function phi_theme_support() {
        remove_theme_support( 'widgets-block-editor' );
    }
    add_action( 'after_setup_theme', 'phi_theme_support' );
    

    Thank you so much. It’s work for me

    hum ha.

    Are we agree that the “solution” you seems to be satisfy with consist in disabling the Gutenberg block based widget interface to get back to the previous “classic” widget one ?

    I feel sorry if I am the only fetish dev in the place, but, I like Gutenberg blocks and I would rather fix that error without disabling the new widget interface.

    Anybody has a clue, an idea or whatever ?

    Thank you for reading.

    • This reply was modified 6 months, 2 weeks ago by etiennesamson.

    I have the same problem…Widgets will not update, gives ‘..invalid JSON…’ error.

    Fresh install, twenty21 theme, all widgets disabled, wordpress 5.8.1

    I want to use the block editor, not revert to the classic via plugin…does a solution exist??

    Seriously, I’d really appreciate a solution to this problem that does not involve reverting to the classic editor. I am surprised that WordPress would allow this to happen and I think there must be a solution that does not involve reverting to ‘classic’ via plugin.

    Thanks much.

    johnravrasta

    (@johnravrasta)

    thanks to @vladytimy i installed this plugin https://wordpress.org/plugins/classic-widgets/ which enabled me to delete many widgets not needed any more.
    With the new widgets editor i was getting an error message and no updates were possible at all!

    In WordPress 5.2 a number of components were moved from the editor package to the block-editor package. Further details can be found on the Make/Core entry detailing the new package. It includes a list of all the items that have moved.

    If your theme or a plugin includes any blocks that haven’t changed to use the block-editor packages and still refer the editor package then it will trigger the notice you are seeing on the block widgets screen.

    If using ESNext syntax JavaScript, you can change the code import { Something } from '@wordpress/editor'; to import { Something } from '@wordpress/block-editor';

    If using the current JavaScript syntax, references to wp.Editor.Something need to change to wp.BlockEditor.Something.

    Hi @peterwilsoncc

    Thank you for your input. I am not using wordpress in a capacity to change core or JS files. I am not sure what the change was and I get slightly different errors from the post author but I assume it is the same error.
    When I edit a storefront footer (they are organised in 4 columns mapped to 4 sections in the customisation screen) and I select the Logo widget then i get this JS error

    `TypeError: Cannot read properties of undefined (reading ‘get’)
    at Ee._createWidget (http://dev.website.com/wp-includes/js/dist/customize-widgets.min.js?ver=779dd942fa1333da9130a6c196eb972e:2:26825)
    at http://dev.website.com/wp-includes/js/dist/customize-widgets.min.js?ver=779dd942fa1333da9130a6c196eb972e:2:27907
    at Array.map (<anonymous>)
    at Ee._updateWidgets (http://dev.website.com/wp-includes/js/dist/customize-widgets.min.js?ver=779dd942fa1333da9130a6c196eb972e:2:27814)
    at Ee.setWidgets (http://dev.website.com/wp-includes/js/dist/customize-widgets.min.js?ver=779dd942fa1333da9130a6c196eb972e:2:28097)
    at http://dev.website.com/wp-includes/js/dist/customize-widgets.min.js?ver=779dd942fa1333da9130a6c196eb972e:2:14135
    at Ua (http://dev.website.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:86:70)
    at Vc (http://dev.website.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:87:312)
    at Object.useState (http://dev.website.com/wp-includes/js/dist/vendor/react-dom.min.js?ver=16.13.1:218:226)
    at d.useState (http://dev.website.com/wp-includes/js/dist/vendor/react.min.js?ver=16.13.1:32:381)`

    Unless i enable the classic widgets plugin I cannot do any work and this error breaks the editing. I load packages the VIP style with wppackagist and editing core files is flaky.

    Based on the current error and the information you shared I am not sure what alternative there is for end users but I think this should be fixed withing core with an adapter or somewhere else.

    Do you have any suggestion if there is such improvement open and worth waiting for or how it can be improved?

    • This reply was modified 5 months, 3 weeks ago by bizmatebiz.
Viewing 15 replies - 1 through 15 (of 20 total)
  • You must be logged in to reply to this topic.