• Resolved Nikola Nikolov

    (@nikolovtmw)


    On a clean install that only has the Seriously Simple Podcasting plugin active and the Twenty Twenty One theme AND after setting WP_DEBUG to true, the following error message is displayed:

    Notice:  Function wp_enqueue_script() was called incorrectly. "wp-editor" script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets). Please see <a href="https://wordpress.org/documentation/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 5.8.0.) in /redacted/path/to/wp/wp-includes/functions.php</b> on line 5905

    You seem to be adding wp-editor as a dependency to the ssp-block-script script, which triggers the above error notice. I can’t tell if there are other side-effects to having the wrong dependency, but this can be an issue during development with strict error reporting.

    My temporary workaround is to unregister all of the player blocks, as well as deregister the ssp-block-script on the Widgets page.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Serhiy Zakharchenko

    (@zahardoc)

    Hi @nikolovtmw,

    Thank you for your message. Though, I checked our plugin and couldn’t find wp-editor dependencies for ssp-block-script .

    Also, I can’t reproduce this Notice on my local site. Could you please confirm that this message disappears when you disable our plugin? Also, what versions of WordPress and SSP do you use?

    Thank you and best regards,
    Serhiy.

    Thread Starter Nikola Nikolov

    (@nikolovtmw)

    Hi @zahardoc ,

    I am using WordPress 6.3.1, and SSP 2.22.0, and Twenty Twenty-One 1.8.

    I have this defined in my wp-config.php:

    define( 'WP_DEBUG', true );
    define( 'SCRIPT_DEBUG', true );

    When I go to the Appearance > Widgets page, I get the following notice at the top(partially obscured by the Widgets heading):

    Digging through the dependencies for ssp-block-script (which are defined here: https://plugins.trac.wordpress.org/browser/seriously-simple-podcasting/trunk/build/index.asset.php ), I found that commenting out the wp-edit-post dependency removes the notice, but causes a JavaScript error. wp-edit-post is actually what has a dependency on wp-editor and so ssp-block-script causes it to be enqueued on the widgets page.

    Below is my installation’s Site Health info. Note that this is a blank test WordPress site. I ran into this issue while working on an actual website, but then I wanted to make sure that the issue happens when there are no other plugins or themes involved. My problem with this error is that I have my local environment setup in a way where every notice causes a fatal error during development and therefore I couldn’t visit the Widgets page at all until I did the workaround of removing the custom blocks and script on the Widgets page.

    Let me know if you are still unable to reproduce this issue, but I believe that with the information provided you should be able to reproduce it.

    I found a way to remove the dependency for wp-edit-post when on the Widgets screen, but you would still have to update the code for your block to handle this appropriately. This is the updated code for the first part of Castos_Blocks::register_castos_blocks():

    	public function register_castos_blocks($handle) {
    		global $pagenow;
    
    		$dependencies = $this->asset_file['dependencies'];
    		if ( $pagenow && 'widgets.php' === $pagenow && false !== in_array( 'wp-edit-post', $dependencies ) ) {
    			array_splice(
    				$dependencies,
    				array_search( 'wp-edit-post', $dependencies ),
    				1
    			);
    		}
    
    		wp_register_script(
    			'ssp-block-script',
    			esc_url( SSP_PLUGIN_URL . 'build/index.js' ),
    			$dependencies,
    			$this->asset_file['version'],
    			true
    		);
    Plugin Author Serhiy Zakharchenko

    (@zahardoc)

    Thank you, @nikolovtmw, for providing such a detailed description.

    I was able to replicate the issue. We’ll fix it in our upcoming plugin releases.

    Thread Starter Nikola Nikolov

    (@nikolovtmw)

    Awesome, thank you @zahardoc ! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Warning on Widgets screen’ is closed to new replies.