Support » Plugins and Hacks » Notice: wp_enqueue_style was called incorrectly.

Notice: wp_enqueue_style was called incorrectly.

  • After enabling wp_debug in wp-config.php, I receive 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 /var/www/public_html/wp-includes/functions.php on line 3245

    I’ve isolated the issue to the SweetCaptcha plugin by disabling every plugin, then immediately enabling individuals.

    I solved the problem by making the following amendments to sweetcaptcha.php:

    delete the line
    wp_enqueue_style( ‘sweetcaptcha_Stylesheet’, plugins_url( ‘css/style.css’, __FILE__ ) ); // TODO

    then, add the line you just deleted to the sweetcaptcha_init function

    secondly, change the “init” hook to the “enqueue styles” hook so it looks like this

    add_action(‘wp_enqueue_scripts’, ‘sweetcaptcha_init’, 10);

    so, all together, it should look like:

    add_action(‘wp_enqueue_scripts’, ‘sweetcaptcha_init’, 10);
    function sweetcaptcha_init() {
    wp_enqueue_script( ‘swtcptcf’, plugins_url( ‘js/swtcptcf.js’, __FILE__ ) );
    wp_enqueue_style( ‘sweetcaptcha_Stylesheet’, plugins_url( ‘css/style.css’, __FILE__ ) ); // TODO


Viewing 1 replies (of 1 total)
  • Plugin Contributor Sweet Captcha


    Hi tim-lar,

    Thank you for submitting your issue and for contributing your vast knowledge to our FREE sweetCaptcha project 😉
    We will check this ASAP and update
    you soon.


Viewing 1 replies (of 1 total)
  • The topic ‘Notice: wp_enqueue_style was called incorrectly.’ is closed to new replies.