get_currentuserinfo 自 4.5 版起已弃用!使用 wp_get_current_user() 代替

get_currentuserinfo is deprecated since version 4.5! Use wp_get_current_user() instead

https://build.trac.wordpress.org/changeset/36278/trunk/wp-includes/pluggable-deprecated.php

使用 4.5 安装或更新 wordpress 后。 产生错误:

Notice : get_currentuserinfo is deprecated function since version 4.5! Use wp_get_current_user() instead. in wp-includes\functions.php on line 3662

More info for issue & solution

只需在插件或主题中找到文本“get_currentuserinfo”并替换为wp_get_current_user() .

因为 deprecated function get_currentuserinfo and arrived new function _wp_get_current_user() 因为:WordPress 4.5.0

function get_currentuserinfo() { 
   _deprecated_function( __FUNCTION__, '4.5', 'wp_get_current_user()' ); 
   return wp_get_current_user(); 
}

按照以下步骤操作。我从同样的错误中恢复了我的一个博客。 1. 安装查询监控插件 2. 查看管理栏通知并单击突出显示的警告。 3. 画面跳转到详细警告说明。 4. Call Stack 部分将告诉您使用 get_currentuserinfo() 的确切位置。 5. 要解决此问题,只需将 get_currentuserinfo() 替换为 wp_get_current_user()