Delete a specific category when deleting a user

  1. delete_user action involves two parameters: $id and $reassign. So you should specify two parameters for the hook.
  2. Because sanitize_term() and sanitize_user() use different ways to sanitize strings, 'tips_' . $_POST['user_login'] and 'tips_' . $user_obj->user_login are not always the same string. So it’s better to use 'tips_' . sanitize_user($_POST['user_login') as term name when inserting the term.

Leave a Comment