Do you want to give your users the option to delete their own accounts? It’s very common to give visitors the option to register an account or membership on your WordPress website, but it usually falls on the web developer to actually delete accounts if requested.
Another option is to give visitors the option to delete their own account.
This option has advantages, but it also has some disadvantages associated with it. This is why you do not see the option to delete an account on every website. WordPress user accounts contain important information like email addresses and user-created content.
Today, I will demonstrate how to give your users the option to delete their WordPress accounts using the Delete Me plugin.
Why Allow Users to Delete Their Account
There are many reasons why someone would want to delete their WordPress user account.
This may include receiving email spam, a dispute in the comments section, not agreeing with the content creators’ opinion, not liking their current username, and many other reasons, but it is not within the visitor’s power to delete the account.
To do this, the visitor must contact the web developer to have their account terminated. That just ends up being more work for the web developer. Giving the option is a great way to make sure it is not your responsibility to delete their information.
On the other end, it might not be the best thing to give a visitor the option to delete the account.
Visitors can be very erratic and might delete their accounts on a whim for any reason. They will then try to contact you to somehow get their account restored. It is also one less subscriber in your email subscription list.
This can hurt your email marketing campaign since it is very difficult to get people to sign up in the first place. Having an individual’s email is very valuable to a web developer and giving the visitor the option to take it away is not a popular choice.
Thus, many websites do not provide this option to visitors.
How to Allow Deleting of User Accounts in WordPress
Step 1: Install Delete Me
The Delete Me plugin grants users with a specific user role the ability to delete their own account. The user role that has this ability is up to the administrator and can be customized on a role by role basis.
Since we want to grant users the ability to delete their account, that will typically mean the Subscriber role., which is where the majority of registered users reside. Upon account deletion, all user content will be deleted and moved into the trash as well.
As you can imagine, this can be a problem if the wrong user role gets deleted, such as an Author. Thus, be very careful about granting this option.
Click on Plugins and select the Add New option on the left-hand admin panel.
Search for Delete Me in the available search box. This will pull up additional plugins that you may find helpful.
Scroll down until you find the Delete Me plugin and click the «Install Now» button and activate the plugin for use.
Step 2: Choosing User Roles
Technically speaking, the plugin is working the moment it has been activated, however, no user roles have been given the ability to delete their account. Thus, the first step after installation is to grant that option.
On the left-hand admin panel, click on Settings and select the Delete Me option.
This page will allow you to customize every aspect of the plugin.
The first series of checkboxes represent the roles on your website. Any checked boxes will allow that particular role to be able to delete their own account.
By default, Super Admin and Administrator level roles already have the ability to delete other accounts and their own accounts should not be deleted without careful consideration.
Check the appropriate box for the desired role to enable their delete account option.
The selected user roles will receive the ability to delete their own account once you save.
Step 3: Customizing the Process
On the second half of this page, you will see a series of options about what happens to users during and after the deletion process.
Note: The default options are more than sufficient for most websites. However, one suggestion I would make is building an exit page. By default, the plugin will bring users back to your homepage, but displaying a goodbye page signaling the account has been deleted will look better.
It is also worth noting that this section is color-coded. If something is in green, that means it is the default value, while if it is in yellow, it means it has been customized.
Go through this section customizing what you feel is necessary.
Once you have made all of the necessary changes, scroll down to the bottom and click on the «Save Changes» button. You can also use the «Restore Default Settings» button to reset the plugin’s settings if something goes wrong.
Congratulations, you have successfully given users the option to delete their own accounts.
Upon deletions, users will be able to register again using the same email address. Any content associated with the old account, including posts and comments, will be deleted and cannot be restored if it was permanently deleted.
Custom User Profile Page Method
Unfortunately, if you are using a custom user profile page, you will have to add a shortcode.
Like most plugins, Delete Me comes with many shortcodes for websites to utilize. All of the shortcodes are located on the settings page in the Shortcode section. You will need to add a shortcode to your custom user profile page template to be able to delete it with this plugin.
Copy the following shortcode:
Simply paste the code into your custom user profile page template. This will now provide the same option to delete someone’s account. If you have multiple custom user profile page templates, you will have to individually add this shortcode to each one.
Give Your Users Control Over Their Account
It’s very easy to give a visitor the option to delete their account, but it is very difficult to get them to sign up.
Thus, you should consider if this option is worth giving.
The number of subscribers your website has is very important, and most web developers do not like to see that number go down. In fact, the majority of websites do not give the option to delete user accounts and if they do, actually make it more trouble than it’s worth to get an account deleted.
This will ensure that the number of subscribers will not go down.
This may help a struggling website keep its subscriber numbers looking good. But once your website grows, getting subscribers is not as hard and it is a good practice to get rid of abandoned accounts. Popular usernames are selected when an account system is introduced.
Deleting the inactive account will allow for these usernames to be used once again by more active users.
Why do you want to give your users the option to delete their own accounts? Do you expect a lot of users to delete their accounts?
Author: Chris Racicot
Chris is the Support Manager at GreenGeeks and has been with the company since 2010. He has a passion for gaming, scripting and WordPress. When he’s not enjoying his sleep, he’s working on his guitar skills and fiddling with 3d printing.