问题
WordPress REST API 使用 POST
/wp/v2/users/ 或者 POST
/wp/v2/users/me 出现状态401错误
{
"code": "rest_cannot_edit",
"message": "Sorry, you are not allowed to edit this user.",
"data": {
"status": 401
}
}
{
"code": "rest_cannot_edit",
"message": "抱歉,您不能编辑此用户。",
"data": {
"status": 401
}
}
原因
1、未授权
2、Cookie失效
使用Postman请求Wordpress REST API会设置Cookie,当执行修改密码请求后Cookie失效,所以再次请求修改密码时,需要清除Cookie