1

Is there any Hook available for user delete in Drupal8. I have some custom data in a custom table and I want to delete those data while I delete any user in Drupal8. Can anybody help me out of this?

1

Use hook_entity_delete().

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21entity.api.php/function/hook_entity_delete/8.6.x

function mymodule_entity_delete(Drupal\Core\Entity\EntityInterface $entity) {
  if ($entity->getEntityType() == 'user') {
     ...
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.