[wp-hackers] wp_enqueue_script was called incorrectly...

BenderisGreat greglancaster71 at gmail.com
Mon Nov 11 18:53:08 UTC 2013


I am trying to enqueue a script, and it's not working out so well for me. 
Here is the code, places after the add_action for the function;

wp_enqueue_script('my_post_like_action', plugins_url().'/js/post-like.js',
array('jquery'), '1.0', true );  
wp_localize_script('my_post_like_action', 'ajax_var', array(  
    'url' => admin_url('admin-ajax.php'),  
    'nonce' => wp_create_nonce('ajax-nonce')  
));  


I am receiving this error:  
 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 /Users/Jared/Documents/Websites/www.local.dev/wp-includes/functions.php
on line 3060



--
View this message in context: http://wordpress-hackers.1065353.n5.nabble.com/wp-enqueue-script-was-called-incorrectly-tp42778.html
Sent from the Wordpress Hackers mailing list archive at Nabble.com.


More information about the wp-hackers mailing list