Delete Users in Bulk in WordPress

How to Bulk Delete Users in WordPress According to Roles

In some cases, it may be necessary to delete users in bulk according to their roles. For example, a membership site may need to do this monthly as some users decline to renew their membership to the site.

Unfortunately, WordPress doesn’t have a good way of doing this by default. The best you can do is use the bulk delete options to select multiple users at once and delete them in one go, which will work when your role list is smaller.

For larger lists, you are probably going to want to find a plugin that can accommodate your needs. For example, most membership plugins typically have tools that will automatically change user roles based on renewal dates and payments you have received.

Today, I will demonstrate how to bulk delete users by roles in WordPress.

Why Delete Users by Role?

Site administrators can create user roles for a variety of purposes, but one of the most common is for testing out new features.

For example, imagine a membership site wanting to test out a new feature. Well, you wouldn’t want users to get access to something that is not ready, so you lock it behind a custom user role that just consists of a dummy account so you can test it.

Once the feature is ready, you don’t need those dummy accounts anymore, thus you may want to delete them.

Another common reason you may need to bulk delete accounts is due to spam. Many spam bots have become complex enough to create dummy accounts on your site. Thus, it may become necessary to delete these accounts when they become too numerous.

If you regularly create new user roles, there will come points where you need to clear them out, so let’s learn how.

How to Delete Users From Roles In Bulk

WordPress allows you to perform bulk actions for posts, pages, taxonomies, and even users. While there are many options you can do in bulk, we are just going to focus on the delete option.

When it comes to user roles, you can sort the list into specific roles.

For example, you can filter the list to only show subscribers, select all of the users you want to delete, and use the bulk options to do so.

This is very simple to do, but as your website grows, it may not be the best way to go about it.

Step 1: Sort By User Roles

Start off by going to the Users area of WordPress. You can find this by clicking the Users option on the left-hand admin panel.

Users

This area of WordPress controls everything related to user roles. By default, it will display all users regardless of their user role. To change this, simply click on the user role that you want to exclusively display.

Choose a user role to filter by

By choosing one of these, only the users assigned to that user role will appear in the list. For sites with a lot of users, you may want to expand the number of users that can be displayed on the list.

To do this, click on Screen Options.

Screen Options

A new area will appear at the top. By default, WordPress will display 20 items at a time. In this case, the items are users. You can change that value to better fit your needs. This can help you perform more bulk actions at once.

Number of Users

Click on the “Apply” button to apply the changes. You should now see a bigger list if you entered a larger value. You may need to reload the page for the changes to apply.

Step 2: Select Users

Now that you have the user role selected it is time to select the users you want to delete. Simply go down the list and check the box next to each name that you want to delete.

Select users to delete from the roles

Alternatively, if you want to delete all of the users within a given user role, you can use the “Select All” option to select all users visible on the list. This is the checkbox next to the Username column at the top or the bottom.

NOTE: This will not select users that are on the next page, only those that are currently visible in the list.

Check all users within a role to delete them

Once you have selected all of the users, you are ready to perform a bulk action.

Step 3: Delete Users from Roles in Bulk

With the users selected, use the Bulk Actions drop-down to select the Delete option.

Note: If you are in a multi-network you will not see the Delete option. Instead, you will have the Remove option. Only a Super Admin will be able to delete users.

Delete Bulk Action

Click on the “Apply” button to delete the selected users.

Apply-Button

You will see a new confirmation screen. It will ask if you are sure and if you want to delete any content assigned to them. In the case of authors, you may want to make sure that the posts are not deleted as it can mess up SEO.

You should use the “Attribute all content to:” option and assign it to the admin or another viable account.

In any case, click on the “Confirm Deletion” button when you have made your choices.

Confirm Deletion button

And that’s it. You can repeat this process as much as need to as many user roles as necessary,

Plugins That Can Help

The above method works fine on smaller websites when you may only need to delete several users, but once you reach a point where you may need to delete hundreds of users, the manual approach is not recommended.

Instead, you’re going to want a plugin that can help you with this task. Here are a few that can help.

Bulk Delete

Bulk Delete can help you with users roles

Bulk Delete is a popular plugin that lives up to its name. It excels at helping users carry out bulk deletion of everything in WordPress from posts to taxonomies, and more importantly, what we are after – users.

It allows you to enter in a variety of conditions like how old an account is, the last time a user has logged in, and more options. You can even set it to repeat delete users based on these conditions to avoid them building up.

It is one of the best ways to handle bulk actions of any kind in WordPress and will prove to be an invaluable tool for a developer. Deleting unnecessary data can help speed up your website, so be sure to take advantage of its other options.

WP Bulk Delete

WP Bulk Delete can help you delete users roles

WP Bulk Delete is another all-in-one plugin that will get rid of all kinds of data in WordPress. On a fundamental level, it is identical to the previous plugin but has a few different filtering options you may find helpful.

One big difference is that this plugin has a Pro version. And the Pro version allows you to assign user data from deleted profiles to new ones.

This can be extremely handy if you want to swap a user’s account for them for some reason. Or just store certain pieces of information from the user, like compiling a list of email addresses of every user.

It is a very handy tool that will fit nicely into most websites and is easy to use, so give it a try.

Easily Manage Your Site with Bulk Actions

As you can see, it is very easy to bulk delete users in specific roles in WordPress, and there are several plugins that can help make it easier as your website grows. However, be sure to remember bulk actions work in most areas of WordPress.

They can help allow you to quickly delete unpublished drafts taking up room, unused taxonomies, and much more. Deleting content that you are not using is a great way to keep the server costs down.

I hope you found this tutorial helpful in learning how to bulk delete users from specific roles in WordPress.

Why did you want to bulk-delete users? Do you use a plugin to help speed things up?

2 thoughts on “How to Bulk Delete Users in WordPress According to Roles”

  1. Thank you, I cloned an old site in godaddy and brought over 600 unwated users/spammers and needed to delete. Worked perfect! Thanks

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.