Delete data from custom table when deleting a user in wordpress

Recently one of our project we need to delete some date from the custom table once user deleted. So that 10 minutes of google got the solutions and solutions is as per below.

Note: Once the user deletes that time “delete_user” action will call and action is as per below.

add_action( ‘delete_user’, ‘function_name’ );

Let’s I try to explain step by step how to delete data in the custom table.

In our case, we have to delete data in six table and all tables are as per screenshot.

Custom Table

PHP Code is as per below.

Check and let me know have any question. send mail at info@zindex.co.in happy to help.

Leave a Reply

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

author-image

Z Index Heroes

Z Index Heroes, We are doing great things together.

Similar Posts

How to fix loading page editor problem in visual composer wordpress
17/12/2018
How to fix loading page editor problem in visual composer wordpress

One of our clients come to us and say that visual composer element does not load in page editor after the update to WordPress 4.8. When we checked it will […]

Read more