unused_field_cleaner
Unused Field Cleaner is a Drupal governance and maintenance module that helps administrators safely identify, archive, deprecate, and remove unused fields from Drupal websites.
Over time, Drupal sites accumulate deprecated, abandoned, migration-generated, and unused fields that increase maintenance complexity, clutter administrative interfaces, slow down development workflows, and create long-term technical debt.
This module provides intelligent field usage analysis, dependency validation, retirement workflows, backup protection, and bulk cleanup operations to safely manage the lifecycle of Drupal fields.
Designed for Drupal 10 and Drupal 11, the module helps organizations improve maintainability, simplify content architecture, and reduce legacy configuration overhead.
Features
Field Usage Detection
- Detect unused and stale fields
- Track field usage across entity bundles
- Calculate usage score and last usage date
- Identify deprecated and retirement-ready fields
Dependency Protection
Prevent accidental deletion of fields referenced in:
- Views
- Entity displays
- Form displays
- Layout Builder
- JSON:API
- Search API
- GraphQL
- Custom integrations
Field Retirement Workflow
- Mark fields as deprecated
- Archive fields before removal
- Retire fields safely
- Track retirement history
Automatic Backups
- Backup field configuration before cleanup
- Export field data snapshots
- Archive retired fields
- Restore support for retired fields
Bulk Cleanup Operations
- Bulk retire fields
- Bulk delete fields
- Dry-run cleanup mode
- Batch processing support
Dashboard & Reporting
- Field usage statistics
- Potential cleanup savings
- Deprecated field tracking
- Dependency reports
- Cleanup history reports
Drush Commands
drush ufc:scan # Scan all fields and update usage data drush ufc:stats # Show dashboard statistics drush ufc:list # Display table of all scanned fields drush ufc:list --status=unused --format=csv # Export unused fields as CSV drush ufc:clean # Retire safe-to-remove fields with automatic backup drush ufc:clean --delete --yes # Permanently delete fields without confirmation drush ufc:clean --dry-run # Preview cleanup actions without making changes drush ufc:deprecate field_name node article # Mark a specific field as deprecated
Benefits
- Reduce technical debt
- Simplify content architecture
- Improve maintainability
- Reduce admin clutter
- Safely retire obsolete fields
- Prevent accidental field deletion
- Improve governance workflows