自版本4.3.0起,不推荐使用WP_Widget的构造函数方法 [英] The called constructor method for WP_Widget is deprecated since version 4.3.0

查看:186
本文介绍了自版本4.3.0起,不推荐使用WP_Widget的构造函数方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新到WordPress 4.3,看来有些东西坏了.

I just updated to WordPress 4.3 and it seems that something is broken.

我收到此错误,该错误显示在我的页面上:

I get this error that shows up on my page:

注意:自版本4.3.0起,已不推荐使用WP_Widget的调用构造函数方法!请使用__construct().在/mnt/stor13-wc1-ord1/754452/www.eden-festival.com/web/content/securewp/wp-includes/functions.php中的第3457行上

Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use __construct() instead. in /mnt/stor13-wc1-ord1/754452/www.eden-festival.com/web/content/securewp/wp-includes/functions.php on line 3457

是否需要修复某些东西?

Is there something that needs to be fixed?

推荐答案

由于不再支持php 7,因此将旧的php 4对象构造替换为__construct(). WordPress开发人员创建了一条通知消息,以便插件开发人员可以更改其插件的工作方式(也可以在下一个php版本上运行).由于php 4早已死亡,因此没有理由使用这种样式的对象构造.

Since php 7 isn't supported anymore, the old php 4 object construct was replaced with __construct(). Wordpress developers created a notice message so the plugin developers would change the way their plugins work (and also so it could run on next php versions). Since php 4 has long been dead, there's no reason to use this style of object construct.

选项1-不会升级到较新的php版本

只需添加 add_filter('deprecated_constructor_trigger_error', '__return_false');

到您的functions.php文件中,它将忽略这些通知.

to your functions.php file it will ignore those notices.

选项2-可能会升级到php 7/更愿意处理问题而不是静默解决

如果这是第三方插件,请注意,如果您自己进行更改,并且插件开发人员发布了更新,则它将覆盖您的更改.与插件开发人员联系以解决此问题将是最好的选择

If this is a third party plugin, beware that if you make the change yourself and the plugin developer releases an update then it will override your changes. Contacting the plugin developer to fix this issue will be the best option

找到有问题的插件并进行更改:

Find the problematic plugin and change:

parent::WP_Widget

收件人

parent::__construct

这篇关于自版本4.3.0起,不推荐使用WP_Widget的构造函数方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆