wordpress函数弃用提示Deprecated: Function create_function() is deprecated

2021/08/0722:46:56wordpress函数弃用提示Deprecated: Function create_function() is deprecated已关闭评论

create_function()函数在php 7.2+版本中已经弃用,如果服务器php版本为7.2+,wordpress主题或wordpress插件中有使用create_function()函数,那么wordpress就会出现“Deprecated: Function create_function() is deprecated”这样的弃用提示,解决方法可以使用低版本的php,或者替换掉create_function()函数,使其支持php 7.2+。

例如以下是会出现已弃用函数提示的代码:

add_action('widgets_init', create_function('', 'return register_widget("contact");'));

删除create_function()函数后,将其修改成下面的代码即可:

add_action('widgets_init', function(){register_widget('contact' );});

PS:不明白的可以搜索create_function()函数相关教程来详细了解。

转载:https://www.boke8.net/wordpress-deprecated-create-function.html

  • 微信扫码赞助
  • weinxin
  • 支付宝赞助
  • weinxin