Prevent the deletion of a user
-
I’m creating a system with data in non-wp tables linked to a user. Is there a way I can prevent (through use of a hook maybe) a user from being deleted if data exists in these tables for a given user?
I saw there was a
delete_user
hook, but I’m not user it will accomplish what I’m after.Will something like this work?
function foo($user_id) { if (user_has_data($user_id)) return false; //i.e. prevent user deletion return true; } add_action('delete_user', 'foo');
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Prevent the deletion of a user’ is closed to new replies.