繁体   English   中英

WordPress升级后,我在pluggable.php中找不到wp_user

[英]After wordpress upgrade I'm getting wp_user not found in pluggable.php

我正在从检查wp用户凭据的应用程序中调用php脚本。 在我将wordpress从4.3升级到4.4(和4.5)之前,它一直工作良好。 确实是我进行这种排序的时候了,但我不知道为什么wp-user不再可用,因为它在包含列表中。

错误:在pluggable.php中找不到wp_user

请参见下面的代码。

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中突然变得必要,以及我的解决方案是否有意义?

从wordpress.org下载更新的wordpress版本,并用更新的wordpress文件夹替换当前的wp-admin和wp-includes文件夹。

希望它能工作。

暂无
暂无

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

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