Notice: wp_register_script was called incorrectly
-
with wordpress 4.0, CubePoints trigger this Notice:
Notice: wp_register_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.this patch should fix it:
— notice.php.orig 2014-10-14 15:26:06.165718687 +0800
+++ notice.php 2014-10-14 15:21:07.041688878 +0800
@@ -30,22 +30,24 @@
/**********************
* Enqueuing Scripts
***********************/
– wp_register_script(
– ‘jQuery_notice’,
– WP_PLUGIN_URL.’/’.str_replace(basename( __FILE__),””,plugin_basename(__FILE__)). ‘jquery.notice.js’,
– array(‘jquery’),
– ‘1.0.1’
– );
– wp_register_style(
– ‘jQuery_notice’,
– WP_PLUGIN_URL.’/’.str_replace(basename( __FILE__),””,plugin_basename(__FILE__)). ‘jquery.notice.css’
– );
–
– function cp_notify_script(){
+ function cp_notify_script(){
+ wp_register_script(
+ ‘jQuery_notice’,
+ WP_PLUGIN_URL.’/’.str_replace(basename( __FILE__),””,plugin_basename(__FILE__)). ‘jquery.notice.js’,
+ array(‘jquery’),
+ ‘1.0.1’
+ );
+
wp_enqueue_script(‘jquery’);
wp_enqueue_script(‘jQuery_notice’);
}
+
function cp_notify_style(){
+ wp_register_style(
+ ‘jQuery_notice’,
+ WP_PLUGIN_URL.’/’.str_replace(basename( __FILE__),””,plugin_basename(__FILE__)). ‘jquery.notice.css’
+ );
+
wp_enqueue_style(‘jQuery_notice’);
}@@ -126,4 +128,4 @@
}}
-?>
\ No newline at end of file
+?>
- The topic ‘Notice: wp_register_script was called incorrectly’ is closed to new replies.