Skip to content

["BUG"] Notice: Function wp_enqueue_style was called incorrectly #101

@felipemontoya

Description

@felipemontoya

Describe the bug

When the plugin is activated, the admin page shows a strong warning:

Notice: Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the openedx-commerce handle. Please see [Debugging in WordPress](https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/) for more information. (This message was added in version 3.3.0.) in /www/stagingwoocommerceplugin_283/public/wp-includes/functions.php on line 6085

This is not breaking any functionality, but it is annoying and we should fix it.

To Reproduce
Steps to reproduce the behavior:

  1. Go to /wp-admin/plugins.php
  2. Click on "Open edX Commerce" > Activate
  3. See error

Screenshots

image

Additional context
I think this is related to a direct call to $this->loader->wp_enqueue_style here. We should add_action at admin_enqueue_scripts as the lines before do.

The styles we are including there are used for the log box in the sync manager
image

Metadata

Metadata

Assignees

Labels

bugReport of or fix for something that isn't working as intendedhelp wantedReady to be picked up by anyone in the community

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions