wp_deregister_script 调用不正确

wp_deregister_script 如果运行的比较早,会报出个错误的提示。修改的方法也很简单。找到调用的代码写在 add_action('wp_enqueue_scripts', ....) 中即可。

wp_deregister_script 调用不正确 的错误提示

Notice: wp_deregister_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 notice was triggered by the l10n handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /html/www.wpcode.com/webroot/wp-includes/functions.php on line 


find . -name "*.php" | xargs grep "wp_deregister_script"


wp_deregister_script('l10n'); # 修改为下面方式

add_action('wp_enqueue_scripts', function() {