Skip to content

Incompatibility with the widget editor from a classic theme #69

@elcapo

Description

@elcapo

The issue

To reproduce this issue:

  1. install the plugin in a WordPress v6.8.2
  2. use a theme with the 3 files below
  3. then navigate to the appearance > widgets page

at that point, this warning will be rendered:

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 Debugging in WordPress for more information. (This message was added in version 5.8.0.) in /var/www/html/wp-includes/functions.php on line 6121

There is information about this in WordPress/gutenberg#67333.

Minimal theme to reproduce the issue

style.css

/*
Theme Name: Editor Conflict
Theme URI: https://example.com
Author: You
Version: 1.0
Description: Minimal theme to reproduce wp-editor enqueue conflict in Widgets screen.
*/

functions.php

<?php

add_action('widgets_init', function () {
	register_sidebar(
		array(
			'id'            => 'primary',
			'name'          => __( 'Primary Sidebar' ),
			'description'   => __( 'A short description of the sidebar.' ),
			'before_widget' => '<div id="%1$s" class="widget %2$s">',
			'after_widget'  => '</div>',
			'before_title'  => '<h3 class="widget-title">',
			'after_title'   => '</h3>',
		)
	);
});

index.php

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Editor Conflict</title>
    <?php wp_head(); ?>
</head>
<body>
    <?php wp_footer(); ?>
</body>
</html>

Solution

The quickest solution I've found is to remove wp-editor from the list of dependencies of the plugin. I'll be sending a PR for consideration a few minutes after publishing this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions