简体   繁体   English

Woocommerce,不推荐使用PHP 7.2函数create_function()

[英]Woocommerce, PHP 7.2 Function create_function() is deprecated

When i activate Woocommerce plugin website giving 500 server error. 当我激活Woocommerce插件网站时,出现500个服务器错误。 I've activate debug mode. 我已激活调试模式。

PHP Deprecated: Function create_function() is deprecated in /var/www/vhosts/WEBSITENAME/httpdocs/wp-content/plugins/features-by-woothemes/classes/class-woothemes-widget-features.php on line 308 不建议使用PHP:在第308行的/var/www/vhosts/WEBSITENAME/httpdocs/wp-content/plugins/features-by-woothemes/classes/class-woothemes-widget-features.php中,函数create_function()被弃用

That's 308 line: 那是308行:

add_action( 'widgets_init', create_function( '', 'return register_widget("WooThemes_Widget_Features");' ), 1 );

How to fix it??? 如何解决???

just replace the mentioned line with: 只需将提到的行替换为:

add_action( 
    'widgets_init', 
    function () { 
        return register_widget("WooThemes_Widget_Features");
    }, 
    1 
);

OH and by the way, if that works, please prepare a PR with the fix in: https://github.com/woocommerce/features/pulls then contact the author on https://wordpress.org/support/plugin/features-by-woothemes to merge it in OH,顺便说一下,如果可行,请在以下位置进行PR修复: https//github.com/woocommerce/features/pulls,然后通过https://wordpress.org/support/plugin/features与作者联系-woo-themes将其合并

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM