admin管理员组

文章数量:1122832

I don't know how but now I am getting this error :

Notice: 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. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in wp-includes/functions.php on line 3049

Notice: wp_enqueue_script 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. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in wp-includes/functions.php on line 3049

Warning: Cannot modify header information - headers already sent by (output started at wp-includes/functions.php:3049) in wp-login.php on line 415

Warning: Cannot modify header information - headers already sent by (output started at wp-includes/functions.php:3049) in wp-login.php on line 427

This is what I get when I try to log in... On other sites, I have only two first errors. I try to fix it but I can't. Any suggestions?

I don't know how but now I am getting this error :

Notice: 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. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in wp-includes/functions.php on line 3049

Notice: wp_enqueue_script 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. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in wp-includes/functions.php on line 3049

Warning: Cannot modify header information - headers already sent by (output started at wp-includes/functions.php:3049) in wp-login.php on line 415

Warning: Cannot modify header information - headers already sent by (output started at wp-includes/functions.php:3049) in wp-login.php on line 427

This is what I get when I try to log in... On other sites, I have only two first errors. I try to fix it but I can't. Any suggestions?

Share Improve this question edited Apr 26, 2019 at 4:39 Andhi Irawan 1311 silver badge10 bronze badges asked Mar 6, 2014 at 19:54 raidenraiden 3391 gold badge3 silver badges3 bronze badges 2
  • 1 The Notices seem pretty self explanatory. What have your tried and what didn't it work? – s_ha_dum Commented Mar 6, 2014 at 20:06
  • @s_ha_dum I have tried many things what I have found on Google... just now toscho's solutions worked for me, and I can login to my admin panel, but what I can see is that something goes wrong with loading style, because font is not the same as it was. I keep getting this errors: – raiden Commented Mar 6, 2014 at 20:35
Add a comment  | 

7 Answers 7

Reset to default 19

Disable all plugins and switch to the default theme. It should be gone now.

Then enable each addon step by step, until the problem comes back. You know the source now, let’s say a plugin.

The plugin calls probably wp_enqueue_script too early. Find all occurrences of that function, then make sure they are bound to specific actions:

  • wp_register_script() should be called for the action wp_loaded
  • wp_enqueue_script on one of the actions
    • wp_enqueue_scripts,
    • admin_enqueue_scripts,
    • customize_controls_enqueue_scripts or
    • login_enqueue_scripts (see this thread for the latter).

Based on Gregory Schultz's solution:

Wrap all your scripts and styles in a function and hook that function to your target enqueue action.

本文标签: functionswpenqueuescript was called incorrectly