term_delete_protection
The Term Delete Protection module prevents taxonomy terms from being deleted
when they are referenced by content or other entities. This helps maintain data
integrity by ensuring that referenced terms cannot be accidentally removed.
The module automatically detects when terms are in use and:
- Removes the delete operation from term listing pages
- Blocks deletion attempts via the delete form
- Shows detailed warnings about which content is using the term
- Protects parent terms if any descendant terms are referenced
This module requires the following modules:
- Taxonomy (Drupal core)
Optional entity type support:
- Commerce Product module (if protecting commerce products)
- Paragraphs module (if protecting paragraphs)
- Groups (if protecting Groups)
- Custom Content Entities (if protecting Custom Content Entities. A custom content entity is the entity you get from drush generate entity:content my_custom_entity).
Installation
Install as you would normally install a contributed Drupal module. For further
information, see
[Installing Drupal Modules](https://www.drupal.org/docs/extending-drupal/installing-drupal-modules).
Configuration
1. Navigate to Administration > Structure > Taxonomy
2. Click "Edit" on the vocabulary you want to protect
3. Expand the "Term Delete Protection" section
4. Select which entity types to check for references:
- Enable term delete protection for nodes (always available)
- Enable term delete protection for commerce products (if Commerce installed)
- Enable term delete protection for paragraphs (if Paragraphs installed)
- Enable term delete protection for Groups (if Group installed)
- Enable term delete protection for Custom Content Entities.
5. Save the vocabulary
The module will now protect terms in that vocabulary from deletion if they are
referenced by the selected entity types.