我正在从一个检查wp用户凭证的应用程序中调用一个php脚本。在我将wordpress从4.3升级到4.4 (和4.5)之前,这很好。现在是我整理这个的时候了,但是我想不出为什么wp-user不再可用了,因为它在包含列表中。
错误: wp_user未在pluggable.php中找到
请看下面的代码。
define( 'SHORTINIT', TRUE );
require_once $abspath . '/wp-load.php';
require_once $abspath . '/wp-includes/user.php';
require_once $abspath . '/wp-includes/pluggable.php';
require_once $abspath . '/wp-includes/formatting.php';
require_once $abspath . '/wp-includes/capabilities.php';
require_once $abspath . '/wp-includes/kses.php';
require_once $abspath . '/wp-includes/meta.php';
require_once $abspath . '/wp-includes/l10n.php';
require_once $abspath . '/wp-includes/class-wp-error.php';
require_once $abspath . '/wp-includes/general-template.php';
require_once $abspath . '/wp-includes/link-template.php';
$the_authenticate = wp_authenticate_username_password('null',$user_name,$user_password);
if( is_wp_error( $the_authenticate ) ) {
echo '{"error":"The username was not recognised"}';
}
else
{
$the_user_authenticate_id = $the_authenticate->ID;
$the_user = get_user_by('login', $user_name);
$the_user_id = $the_user->ID;
if ( !$the_user )
{
//echo "{'error':'The username was not recognised'}";
}我已经找到了解决方案,我现在需要包括以下内容。
require_once $abspath . '/wp-includes/class-wp-roles.php';
require_once $abspath . '/wp-includes/class-wp-user.php';
require_once $abspath . '/wp-includes/class-wp-role.php';请有人解释一下为什么wordpress 4.4中突然需要这些额外的内容,以及我的解决方案是否有意义?
发布于 2016-08-13 12:49:48
从wordpress.org下载更新的wordpress版本,并替换当前的wp-admin和wp-包含更新的wordpress文件夹。
希望它能成功。
https://stackoverflow.com/questions/38932105
复制相似问题