WordPress.org

Support

Support » Plugins and Hacks » PHP Notice: wp_enqueue_script was called inccorectly

PHP Notice: wp_enqueue_script was called inccorectly

  • You need to call wp_enqueue_script() inside of the 'wp_enqueue_script‘ action hook. Right now you’ll get this error if you have WP_DEBUG on:

    PHP 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 init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.)

    Example:

    function comment_ca_va() {
    
         wp_enqueue_script( "CommentCaVa", plugins_url() . "/CommentCaVa/CommentCaVa.js" );
    }
    add_action( 'wp_enqueue_script', 'comment_ca_va' );

    http://wordpress.org/extend/plugins/commentcava/

  • The topic ‘PHP Notice: wp_enqueue_script was called inccorectly’ is closed to new replies.