Sweet Captcha
Notice: wp_enqueue_style was called incorrectly. (2 posts)

  1. tim-lar
    Posted 1 year ago #

    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


  2. Sweet Captcha
    Plugin Contributor

    Posted 1 year ago #

    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.


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.