In the list of capabilities, I found there's both remove_users
and delete_users
. It's not clear to me what remove_users
is supposed to do, the Codex documentation just says it was introduced in version 3.0 (/).
In the list of capabilities, I found there's both remove_users
and delete_users
. It's not clear to me what remove_users
is supposed to do, the Codex documentation just says it was introduced in version 3.0 (https://wordpress.org/support/article/roles-and-capabilities/).
2 Answers
Reset to default 13The difference is really no difference in regular (single install) WordPress. It's in a multisite install (network) where there is a difference.
In multisite, only a Super Admin (who can manage everything on the network) has delete_users
capability, while an "admin" (who would own/manage a single site) can remove_users
from their site, but cannot delete them from the network.
Hope that helps clarify.
remove_users
is no more used.
Source: https://wpfront.com/wordpress-plugins/user-role-editor-plugin/wordpress-capabilities/#remove_users
Use delete_users
instead both in a multisite install (network) or a single install.
We also can read some mistakes on the web like here:
Even with the delete_users permission you can not delete users with more permissions that you.
That's wrong, an editor user with delete_users
(and list_users
) capability can delete an administrator with following code:
function add_editor_delete_users_cap() {
if ( $role = get_role( 'editor' ) ) {
if( !$role->has_cap( 'list_users' ) ) $role->add_cap( 'list_users' );
if( !$role->has_cap( 'delete_users' ) ) $role->add_cap( 'delete_users' );
}
}
add_action( 'admin_init', 'add_editor_delete_users_cap' );