【问题标题】:Same error message multiple times via Wordpress error log通过 Wordpress 错误日志多次出现相同的错误消息
【发布时间】:2017-08-22 21:28:03
【问题描述】:

当一个页面只加载一次时,我多次收到相同的错误日志消息,我想知道这对于 Wordpress 是否正常?如果没有,我该如何解决这个问题? 以下是我的错误日志中的 sn-p。前 5 行在加载 1 页时会复制 5 次。这不可能是对的,对吧?谢谢!

    [22-Aug-2017 19:18:11 UTC] PHP Notice:  Use of undefined constant ‘TwitterOAuth’ - assumed '‘TwitterOAuth’' in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Woothemes_Widget_Testimonials is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Affiliates_Registration_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Twitter_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Recent_Posts_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Flickr_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
[22-Aug-2017 19:18:11 UTC] PHP Notice:  Use of undefined constant ‘TwitterOAuth’ - assumed '‘TwitterOAuth’' in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Woothemes_Widget_Testimonials is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Affiliates_Registration_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Twitter_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Recent_Posts_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Flickr_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
[22-Aug-2017 19:18:11 UTC] PHP Notice:  Use of undefined constant ‘TwitterOAuth’ - assumed '‘TwitterOAuth’' in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Woothemes_Widget_Testimonials is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Affiliates_Registration_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Twitter_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Recent_Posts_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Flickr_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
[22-Aug-2017 19:18:11 UTC] PHP Notice:  Use of undefined constant ‘TwitterOAuth’ - assumed '‘TwitterOAuth’' in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Woothemes_Widget_Testimonials is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Affiliates_Registration_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Twitter_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Recent_Posts_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Flickr_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
[22-Aug-2017 19:18:11 UTC] PHP Notice:  Use of undefined constant ‘TwitterOAuth’ - assumed '‘TwitterOAuth’' in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Woothemes_Widget_Testimonials is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Affiliates_Registration_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Twitter_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Recent_Posts_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir
    [22-Aug-2017 19:18:11 UTC] PHP Notice:  The called constructor method for WP_Widget in Etheme_Flickr_Widget is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /filedir

【问题讨论】:

标签: php wordpress error-handling


【解决方案1】:

提供这些小部件的插件/主题已过时,并且正在使用调用构造方法的旧方式。将插件和主题更新到最新版本。

【讨论】:

  • 感谢您的想法,伊戈尔。我的问题不是关于为什么我会收到这些错误消息,而是为什么它们都重复了 5 次。我只显示了 1 轮错误消息,但想象一下每次加载页面时这些都重复 5 次
  • @bob_hardy1703 啊,当我回答你的问题时,我只看到了 5 个不同的错误。每次页面加载时,您是否同时有 5 个这样的部分?如果这些 5 块在不同的时间,它只会发生在每个页面加载。如果他们实际上是在同一时间,那就很奇怪了。你有 5 个小部件区域吗?
【解决方案2】:

您没有看到重复的错误消息,这些错误消息都略有不同。第一条消息指定Woothemes_Widget_Testimonials中的方法已弃用,第二条指定Affiliates_Registration_Widget中的方法已弃用,第三条指向Etheme_Twitter_Widget,依此类推。

需要在指定的 5 个位置中的每一个中修复代码,以便消息消失。

【讨论】:

  • 对不起,我以为我说清楚了,但我想我没有。我更新了错误部分以显示每次加载页面时实际显示的内容。我知道所有 5 个都是不同的错误,但是所有 5 个重复 5 次,如现在所示。 :) 抱歉问题的措辞不佳
  • 啊,是的,这更有意义。当这些错误发生时,您是否碰巧在一个正在加载的页面上有 5 个小部件区域?您可能有一段代码在重复这些代码段中的每一个错误 5 次。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-25
  • 1970-01-01
  • 2013-09-17
  • 2012-09-12
相关资源
最近更新 更多