The default setup of Paid Memberships Pro configures all members as users with the default role (under Settings > General) and (selected) membership level. When a user cancels membership, the user’s subscriber account remains and will show up under the Users list in the WordPress Admin.
The code recipe below will delete that user account upon cancellation.
Why we do not recommend doing this…
If your content restrictions are adequately configured, there is no downside to these non-member accounts. The upside is that the user can more easily “join again”, and you as admin can track their membership history. You can also display specialized messaging to these users on your site inviting them to “re-subscribe” via the Memberships > Advanced Settings > “Message for Logged-in Non-members” field.
Also note that if the user accounts are deleted, corresponding order data in your Memberships > Orders admin will be incomplete (the orders will appear but the corresponding user account will be missing). Their own personal Invoice History on the Membership Invoices page will also be lost, should that member sign up for membership again.
The Code Recipe
Adding the Recipe to Your Website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.
Free Course: Membership Site Development—The Basics
Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.