Title: wp_enqueue_script called incorrectly
Last modified: August 20, 2016

---

# wp_enqueue_script called incorrectly

 *  Resolved [pndsWeb](https://wordpress.org/support/users/pndsweb/)
 * (@pndsweb)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/wp_enqueue_script-called-incorrectly/)
 * WordPress debug notice thrown: 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.
 * Versions: ***************
    Wordpress: 3.5, Multi-site Events Made Easy (EME):
   1.0.7, network activated PHP: 5.3.10
 * Offending file: **************
    events_manager.php, line 38: `wp_enqueue_script('
   client_clock_submit', plugin_dir_url( __FILE__ ) . 'js/client-clock.js', array('
   jquery'));`
 * Found by commenting out line 38 and the notice goes away. At the point of execution
   of the code fragment below, there is no session id. The notice appears in both
   the frontend and the admin pages. Contrary to what the notice says, it looks 
   to me as if the init hook is in place before the wp_enqueue_script call. I did
   NOT see a wp_enqueue_script**s** call (note the plural form of script(s).) The“
   Use the client computer clock for the calendar” setting is “yes” in the settings
   page for EME
 * Code fragment: ***************
    `\`// Client clock usage, if wanted if (get_option('
   eme_use_client_clock')) { // If needed, add high priority action to enable session
   variables. if (!session_id()) add_action('init', 'session_start', 1); // Embed
   client-clock.js in webpage header. wp_enqueue_script('client_clock_submit', plugin_dir_url(
   __FILE__ ) . 'js/client-clock.js', array('jquery')); // Declare URL to the file
   that receives AJAXed client clock data (wp-admin/admin-ajax.php). wp_localize_script('
   client_clock_submit', 'eme_ajax', array('ajaxurl' => admin_url('admin-ajax.php')));
 *  // the next 2 actions are executed by the ajax JS call "client_clock_submit"
   //
   Add high priority action to receive clock data from users who are not logged-
   in. add_action('wp_ajax_nopriv_client_clock_submit', 'eme_client_clock_callback',
   1); // Add high priority action to receive clock data from logged-in users. add_action('
   wp_ajax_client_clock_submit', 'eme_client_clock_callback', 1); }`
 * Other network activated plugins: ***************
    Akismet Broken Link Checker
   BWP Google XML Sitemaps Fast Secure Contact Form Google Analytics for WordPress
   Proper Network Activation Quick Cache WordPress Importer WP-FileManager WP-Mail-
   SMTP WP-Table Reloaded WP Realtime Sitemap SCloner
 * Network enabled themes: ****************
    Thematic Our own child theme of Thematic
 * Our production URL: ****************
    [http://www.ncwsa.org/events_calendar/](http://www.ncwsa.org/events_calendar/)(
   WP Debug is OFF) Lots of events Out test URL: ************** Send me an email
   if you want our test environment URL. (WP Debug is ON) Very few test events
 * [http://wordpress.org/extend/plugins/events-made-easy/](http://wordpress.org/extend/plugins/events-made-easy/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Franky](https://wordpress.org/support/users/liedekef/)
 * (@liedekef)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/wp_enqueue_script-called-incorrectly/#post-3379306)
 * This should fix the notice:
 * [http://plugins.trac.wordpress.org/changeset/655287](http://plugins.trac.wordpress.org/changeset/655287)
 *  Plugin Author [Franky](https://wordpress.org/support/users/liedekef/)
 * (@liedekef)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/wp_enqueue_script-called-incorrectly/#post-3379378)
 * Btw, the latest trunk version also contains some other small fixes so WP Debug
   is happy again.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘wp_enqueue_script called incorrectly’ is closed to new replies.

 * ![](https://ps.w.org/events-made-easy/assets/icon-256x256.png?rev=1856035)
 * [Events Made Easy](https://wordpress.org/plugins/events-made-easy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-made-easy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-made-easy/)
 * [Active Topics](https://wordpress.org/support/plugin/events-made-easy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-made-easy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-made-easy/reviews/)

## Tags

 * [wp_enqueue_script](https://wordpress.org/support/topic-tag/wp_enqueue_script/)

 * 2 replies
 * 2 participants
 * Last reply from: [Franky](https://wordpress.org/support/users/liedekef/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/wp_enqueue_script-called-incorrectly/#post-3379378)
 * Status: resolved