首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >wordpress中登录页面出现错误

wordpress中登录页面出现错误
EN

WordPress Development用户
提问于 2019-02-20 11:57:53
回答 1查看 163关注 0票数 0

今天,我在wp-admin和wp-login.php中的wordpress博客出错了。

代码语言:javascript
复制
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. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/sedabaran/public_html/wp-includes/functions.php on line 4196

Notice: wp_deregister_script was called incorrectly. Do not deregister the jquery script in the administration area. To target the front-end theme, use the wp_enqueue_scripts hook. Please see Debugging in WordPress for more information. (This message was added in version 3.6.0.) in /home/sedabaran/public_html/wp-includes/functions.php on line 4196

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. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/sedabaran/public_html/wp-includes/functions.php on line 4196

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.0.) in /home/sedabaran/public_html/wp-includes/functions.php on line 4196

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-login.php on line 423

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-login.php on line 436

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/sedabaran/public_html/wp-includes/pluggable.php on line 948

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 949

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 950

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 951

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 952

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 953

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 956

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 957

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 960

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 961

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 962

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 963

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 966

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 967

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 968

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 969

Warning: Cannot modify header information - headers already sent by (output started at /home/mywebsite/public_html/wp-includes/functions.php:4196) in /home/mywebsite/public_html/wp-includes/pluggable.php on line 972

如何修复此错误请注意,我无法登录到该站点,非常感谢

EN

回答 1

WordPress Development用户

发布于 2019-02-20 12:17:39

造成这一错误的主要原因是,在您的站点的某个地方,它可能是您的主题或插件,有人错误地使用了某些功能。

错误消息本身很好地描述了这个问题:

  1. 脚本和样式不应该在wp_enqueue_scripts、admin_enqueue_scripts或login_enqueue_scripts挂钩之前注册或排队。
  2. 不要在管理区域取消jquery脚本的注册。若要针对前端主题,请使用wp_enqueue_scripts挂钩。

所有其他错误都是由于前4条错误消息被提前输出而引起的,并且在前4条被解析后就会消失。

这意味着有人为排队和退出队列脚本添加了代码,这些代码看起来可能很像这样:

代码语言:javascript
复制
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'some/url/here', ...);
wp_enqueue_script( 'jquery' );

造成这些错误的原因是,这些函数显然只是访问了functions.php或插件文件,而没有正确地使用钩形

至少,它应该是这样的:

代码语言:javascript
复制
function wpse_329345_bad_jquery_nonsense() {
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', 'some/url/here', ...);
    wp_enqueue_script( 'jquery' );
}
add_action( 'wp_enqueue_scripts', 'wpse_329345_bad_jquery_nonsense' );

首先,我要查找有问题的代码(如果其他人正在处理站点)是主题目录中的functions.php文件的底部。如果您找到它,可以在我的示例中看到我所做的更改(或者删除它,因为您应该使用不是在排队等待你自己的jQuery)。这应该能解决这个问题。

都是这么说的。这些只是调试消息,目的是通知开发人员他们做错了什么。出现这些情况是因为您已经在站点上启用了调试。如果您的站点处于活动状态,则不应启用可见的调试消息。您可以通过禁用WP_DEBUG来做到这一点。启用它的说明是这里。遵循这些,但是将值设置为false而不是true来禁用它。

票数 1
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/329345

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档