WP CLI说明文档

wp user remove-role

命令概述

用于从指定用户移除一个或多个角色。

适合在需要撤销用户权限或调整角色分配时使用。

参数列表

参数 说明
<user> 用户ID、邮箱或登录名。
[<role>...] 从用户移除指定角色。

常用示例

从用户12移除author角色

$ wp user remove-role 12 author
Success: Removed 'author' role for johndoe (12).

从用户12移除多个角色

$ wp user remove-role 12 author editor
Success: Removed 'author', 'editor' roles for johndoe (12).