在WordPress中,cp_admin_init和_canonical_charset的有效回调



我正在使用WordPress 3.5,子主题为Twenty Eleven 1.5。突然,我得到了以下警告,

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'cp_admin_init' was given in /home/templ/public_html/wp-includes/plugin.php on line 406
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '_canonical_charset' was given in /home/templ/public_html/wp-includes/plugin.php on line 173

我正在使用以下插件:

  1. 下载管理器 2.3.9
  2. WordPress-SEO 1.4.7
  3. WP-PAGENAVI 2.83

还有几点:

1)如果我给出 mysite.com 它会给出超过2行的警告。如果我给 www.mysite.com,下面几行还包括,

Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-includes/pluggable.php on line 876

2)如果我给出 mysite.com/wp-admin/www.mysite.com/wp-admin/,它给出了第一个警告和第三个警告。

3)如果我去 www.mysite.com/wp-login.php,它会给出以下5个警告。

Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'cp_admin_init' was given in /home/templ/public_html/wp-includes/plugin.php on line 406
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '_canonical_charset' was given in /home/templ/public_html/wp-includes/plugin.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-login.php on line 368
Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-login.php on line 380
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'wp_authenticate_spam_check' was given in /home/templ/public_html/wp-includes/plugin.php on line 173

4)如果我提供正确的用户名和密码,它将不会登录。给出以下问题,

ERROR: Invalid username or incorrect password.
ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

我正在努力寻找解决方案。我不能。谁能帮我?

听起来像是安装损坏。 因此,您有几种选择可以解决此问题:

  • 尝试使登录再次运行并通过wp-admin进行升级:如下所述。
  • 执行手动更新:http://codex.wordpress.org/Updating_WordPress#Manual_Update

但首先:进行备份

请务必备份您的安装!继续之前: http://codex.wordpress.org/WordPress_Backups

使登录工作:掩盖症状

首先,我将禁用调试输出,因为这应该可以解决大多数这些问题。 当 Wordpress 中出现警告时,PHP 开始编写响应正文并关闭响应的标头部分。这意味着每当 Wordpress 在发出原始警告后尝试添加另一个标头时,PHP 都会引发另一个警告:

Warning: Cannot modify header information - headers already sent by (output started at /home/templ/public_html/wp-includes/plugin.php:406) in /home/templ/public_html/wp-login.php on line 380

因此,如果我们禁用调试,那么我们应该能够掩盖症状。这是针对更大问题的快速补丁,我们必须通过就地升级来解决

禁用调试

确保以下常量存在且设置正确位于wp-config.php文件中

define('WP_DEBUG', false);

define('WP_DEBUG_DISPLAY', false);

现在,您应该能够以管理员身份登录您的网站而不会出错。

禁用您的插件

禁用Plugins -> Installed Plugins中的所有插件 这是必须的,以便我们可以确保更新顺利进行。

进行更新

转到Dashboard -> Updates,然后单击"Update Now"或"Re-install Now

重新激活您的插件

重新激活Plugins -> Installed Plugins中的所有插件,并在必要时进行更新。

就是这样

这是重新安装Wordpress的过程。 这里的关键是您在生产站点上启用了调试,这不好。 应始终将WP_DEBUGWP_DEBUG_DISPLAY设置为在生产环境中false

最新更新