Here 您将找到支持的所有参数get_users()
.
$blogusers = get_users( [
\'role\' => \'subscriber\',
// limit the number of rows returned
\'number\' => 100,
] );
foreach ( $blogusers as $user ) {
wp_delete_user( $user->ID );
}
或仅返回ID:
// $blogusers is array of IDs
$blogusers = get_users( [
\'role\' => \'subscriber\',
// return only user ID
\'fields\' => \'ID\',
// limit the number of rows returned
\'number\' => 100,
] );
foreach ( $blogusers as $user_id ) {
wp_delete_user( $user_id );
}