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.10Offending 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_scripts 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
SClonerNetwork enabled themes: ****************
Thematic
Our own child theme of ThematicOur production URL: ****************
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
The topic ‘wp_enqueue_script called incorrectly’ is closed to new replies.