database – Delete user with only subscriber role


I have a site which have 90k+ user with subscriber roles.I want delete user with only subscriber role using phpmyadmin . So I know how to delete it But some users have multiple roles for example few users have both editor and subscriber role . Now my query is deleting all the user which subscriber roles including users which have multiple roles but I don’t want that .So what should I update in my query to delete users which have only subscriber role.
This is my current query

DELETE FROM  wp_users INNER JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id WHERE meta_key = 'wp_capabilities'AND meta_value  LIKE '%subscriber% .

Any advice will be helpfull and thanks in advance and can anyone tell is this query also deleting fields in wp_usermeta right?

RDX023 2 years 2022-07-28T15:26:56-05:00 0 Answers 0 views 0

Leave an answer