What do you do when you need to delete a large number of users based on their roles in WordPress? While you could spend hours going through each profile and changing or removing them one by one, there is a much easier way to bulk delete WordPress users.
Over time, your list of registrations can become quite long. There could be pages and pages of people who are assigned a specific role that need to be cleaned out. This is when a bulk feature would become very useful.
In this tutorial, I’ll show you how to bulk delete users. Depending on the number of entries you have, the following could save you a great deal of time.
Why would you delete users according to their roles?
Because admins are able to add roles for a variety of purposes, there may come a time when those accounts are no longer necessary. This could be part of a revamping processes to remove potential spam accounts or eliminating specific people from the site altogether.
By selecting the entire group, you can use the following to remove them all without searching for each individual user throughout the system. For example, if you created an account type for students to access an academic blog, you can remove them all at once at the end of the school year.
Viewing and Deleting User Roles in the Admin Panel
One method to delete several users simultaneously is by viewing them in the admin panel and then selecting them for deletion. In this method, you don’t have to install any new plugins or make major alterations to the website. It’s perhaps one of the easiest ways to bulk delete WordPress users quickly.
To do this:
Go to the “Users” area of the WordPress admin panel.
Above the window for the usernames and email addresses, you will see links showing you the number of users in each particular role. Take note of the role you want to delete in bulk. You will need this number for the next step.
Click on the tab labeled, “Screen Options.” It will be near the top right of the screen.
A window will slide down showing options for displaying the type of users available. Under the area for “Pagination,” you will see a text box with a numerical field. By default, WordPress sets this to 20. As a result, WordPress only show 20 people per page. Change this number to the same number showing next to the role you want to delete noted in Step 2.
Click the “Apply” button. WordPress will then display that number of users in the screen.
Click the link of the role of users you wish to cut. Because you set the number to show as the same as those in this role, all of the users will be available.
Click the check box on the top left next to the “Username” field and directly below the “Bulk Actions” drop down. This will select all users instantly.
Now, click the Bulk Actions drop down and select “Delete.”
Next, click the “Apply” button on the right of the drop down.
WordPress will show a new screen displaying all the users you are about to drop. If you are sure you want them removed, click the “Confirm Deletion” button below this list.
Note that this will only remove users within that particular role. This is useful if the role is used as a bulk method for temporary accounts such as interns, students, volunteers or other non-permanent individuals to a business.
If you don’t want to delete a few of the users but want to get rid of the rest, you can uncheck the box next to each name after clicking the box in Step 7. This way, you can keep those users on the system while deleting the others.
Using Bulk Delete to Remove Users from WordPress
What if you have thousands of users to remove and need an easier method? Today, I’m using the Bulk Delete plugin to remove users en mass. This tool is exceptionally useful as it will also let you remove many other elements from WordPress in bulk such as posts, drafts and pages.
To use Bulk Delete:
Go to the plugins area of WordPress and add a new plugin.
Search for, “Bulk Delete” in the search box on the right.
Install and activate the plugin. This will add a new feature to WordPress labeled, “Bulk WP.”
Click this new tool.
Under Bulk WP, you’ll see an option for “Bulk Delete Users” on the left. Click this link.
The first option available is to delete users by role. Select the role of those you wish to delete by checking the corresponding box.
NOTE: Bulk WP also lets you filter user activity. This is helpful if you want to remove those individuals who have not logged in recently or have never created a post in the system. You can also set this deletion to be automatic based on a schedule. Unfortunately, this option is only available to Pro versions of the plugin.
Once your options are selected, click the “Bulk Delete” button on the bottom left.
If the website is having problems trying to delete more than 1000 accounts at the same time, you can use the “Only delete first…” option in Bulk WP. Start with “100” at a time and increase the number if WordPress doesn’t time out.
Bulk WP also comes with the ability to remove accounts according to meta information. The drop down under the user meta will list all data your WordPress uses in terms of a registered account. Because plugins will often include their own meta data for an individual user, this list may constantly change. For instance, Yoast SEO will add user meta data when it’s installed.
Over time, your website can become filled with all kinds of data and information that may need a regular cleaning. With a few clicks of the mouse, you can bulk delete users and clean up your database. Depending on what you’re removing, this may even free up resources for the site which will result in a speed improvement.
Other Plugins to Delete Data in Bulk
WP Bulk Delete
WP Bulk Delete is another all-in-one plugin that will get rid of all kinds of data in WordPress. While it has all the same functionality as the one I mentioned above, it also lets you assign the deleted user data to another account. However, this function is only available in the Pro version.
AMR Users
If you want to add a bit more functionality behind editing details, AMR Users is a good tool to have. It has a variety of configurations that give you more control including the ability to delete a group of users and exporting to CSV files for spreadsheet software. You can also make some information public by using a shortcode.
User Role Editor
Changing the capabilities of roles is useful when you want certain people to access specific WordPress elements. User Role Editor gives you that ability. Aside from deleting accounts, you can also modify front-end items as well as eliminate certain widgets from being viewed by a user in that role.
Getting rid of data in bulk is an exceptionally useful tool to have. This is especially true as your site develops over time. Before you know it, you can have thousands of pages dedicated to registered users. Keep your site clean by getting rid of information that is no longer needed. It benefits you as a developer as well as the health and performance of the site.
Do you use custom roles in your site? How often do you have to remove inactive users or otherwise clean up your site from unused materials?
Very helpful thank you!
Thank you, I cloned an old site in godaddy and brought over 600 unwated users/spammers and needed to delete. Worked perfect! Thanks