解决create_function()问题

最近把 WordPress 集成到了 Sentry 里面,结果发现这几天已经有好几千条异常信息了:

最多的一个错误详情是这里

导致错误的是这行代码:

add_filter(‘pre_site_transient_update_themes’, create_function(‘$a’, “return null;”));

它本来的作用是禁用主题插件更新,PHP新版本不支持这样写,建议是使用匿名函数(闭包)

把这行代码改成这样即可:

add_filter(‘pre_site_transient_update_themes’, function() {
return null;
});