Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Notice on Widgets screen when upgrading to WordPress 5.8 #17275

Closed
4 of 9 tasks
PanuWeb opened this issue Jul 22, 2021 · 17 comments · Fixed by #17999
Closed
4 of 9 tasks

PHP Notice on Widgets screen when upgrading to WordPress 5.8 #17275

PanuWeb opened this issue Jul 22, 2021 · 17 comments · Fixed by #17999
Labels
severity: minor Yoast: Management Issues about options and management of the plugin

Comments

@PanuWeb
Copy link

PanuWeb commented Jul 22, 2021

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

After upgrading to wordpress 5.8, when I access the widgets (Appearance> Widgets) I get a PHP "Notice" error at the top of the page.

Please describe what you expected to happen and why.

What I expected is that it loads the Widgets screen without showing any errors.

How can we reproduce this behavior?

  1. Upgrade to or install Wordpress 5.8
  2. Disable all plugins
  3. Install and activate the twenty twenty-one theme
  4. Install and activate Yoast 16.7
  5. Set WP_DEBUG and WP_DEBUG_DISPLAY constant to true
  6. Go to Appearance > Widgets

Technical info

  • If relevant, which editor is affected (or editors):
  • Classic Editor
  • Gutenberg
  • Classic Editor plugin
  • Which browser is affected (or browsers):
  • Chrome
  • Firefox
  • Safari
  • Other

Used versions

  • WordPress version: 5.8
  • Yoast SEO version: 16.7
  • Gutenberg plugin version: default for WordPress 5.8
  • Classic Editor plugin version: -
  • Relevant plugins in case of a bug: -
  • Tested with theme: Twenty Twenty-one

PHP Notice received

Notice: wp_enqueue_script() ha sido llamada de forma incorrecta. "wp-editor" script should not be enqueued together with the new widgets editor (wp-edit-widgets or wp-customize-widgets). Por favor, visita Depuración en WordPress para más información. (Este mensaje fue añadido en la versión 5.8.0). in /var/www/html/rbl-tienda/wp-includes/functions.php on line 5535

Widgets-Robalir-Tienda-—-WordPress

@Djennez
Copy link
Member

Djennez commented Jul 23, 2021

Confirmed. The wp-editor script that is being referred to is loaded as a dependency of structured-data-blocks-***.js in wordpress-seo/src/generated/assets/plugin.php.

Internal issue created here

@Djennez Djennez added severity: minor Yoast: Management Issues about options and management of the plugin labels Jul 23, 2021
@michaelbriantina
Copy link

@karan4official
Copy link

Its not yet fixed with Yoast SEO 17.0! Released on: August 24th, 2021

@apmeyer
Copy link

apmeyer commented Sep 22, 2021

Just here to make a note that this is still not fixed.

Perhaps before enqueueing assets you could check to ensure you're not enqueuing them on the widget editor screen.

global $pagenow;

if ( $pagenow !== 'widgets.php' ) {
  // enqueue your stuff
}

@bobbingwide
Copy link
Contributor

I noticed this problem with my own blocks. bobbingwide/bobbingwide#30 (comment)
Before developing a proper fix I developed a quick and dirty hack that prevents the Notice from being issued.
The fix is to remove the filter function that issues the User Notice

remove_filter( 'admin_head', 'wp_check_widget_editor_deps' );

this line of code can be implemented in a child theme's functions.php file.

@jonathanlundstrom
Copy link

jonathanlundstrom commented Sep 29, 2021

Come on now @Djennez & @michaelbriantina. It's now been over 2 months and this issue has not been resolved. You've flagged this as a minor issue, but every single WordPress user above 5.8 who is using this plugin experiences this issue. I would say this is rather, a big issue which should be prioritised. It's also something that could most likely be fixed with a simple if-statement.

@LukaszJaro
Copy link

Non-yoast user here, getting same error, this is not yoast specific.

@apmeyer
Copy link

apmeyer commented Oct 8, 2021

@LukaszJaro a variety of plugins are causing this error. Gravity Forms, for example, is another one leading to the error. Some themes are also causing it. Unless it's been fixed Yoast is definitely one of the plugins causing the error.

@jordan-webdev
Copy link

Getting this issue too.

@Josefism
Copy link

Josefism commented Nov 6, 2021

Just got this issue on a new Yoast 17.5 install on WordPress 5.8.1

@talss89

This comment has been minimized.

@Djennez
Copy link
Member

Djennez commented Nov 10, 2021

I've raised this issue internally again. If it gets priority, this thread will be updated.

However, this notice is only visible when you have debugging enabled and it is not breaking functionality as far as we can see. That is why it's not a severe issue.

@dingo-d
Copy link

dingo-d commented Dec 30, 2021

Got this error when testing building an FSE theme and when I added the add_theme_support('widgets'); on the widgets screen, I got the same error. The error is removed when I disable Yoast, so my guess is that Yoast doesn't check the $hook_suffix when enqueueing the scripts (it's listed as a dependency of structured-data-blocks-1780.js file).

Tried doing

add_action('admin_enqueue_scripts', function(string $hookSuffix) {
	if ($hookSuffix === 'widgets.php') {
		wp_dequeue_script('wp-editor');
	}
}, 10, 1);

But that didn't help (tried increasing the priority).

@apmeyer
Copy link

apmeyer commented Dec 30, 2021

@Djennez When you're trying to debug something else and have to constantly navigate around the errors Yoast is causing, it's extraordinarily frustrating. So, yes, it may only be an issue with debugging is enabled, but for those of us who need to debug it's a pretty big deal.

@alexholsgrove
Copy link

Still an issue 6 months later, with version 18.0 and WordPress 5.9. Please fix this, even if you think it's low priority.

@Djennez
Copy link
Member

Djennez commented Jan 27, 2022

The devs are having a look at it.

@Djennez
Copy link
Member

Djennez commented Jan 27, 2022

Fixed and lined up for the 18.2 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity: minor Yoast: Management Issues about options and management of the plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.