This module provides a tool to identify and delete orphaned paragraphs. It lists paragraph types used in your content, allowing you to clean up unused paragraphs.
Paragraph Cleanup shows how each paragraph type is used, and safely removes paragraphs that no content uses anymore.
Paragraphs are saved separately from the content that holds them. When content is deleted, or a paragraph is removed from it, the paragraph can stay behind in the database as an orphan. Over time, orphans and old paragraph revisions grow the database, slow down queries and bloat backups. Paragraph Cleanup finds them, lets you review them per paragraph type, and deletes them only when it is safe.
Features
- Overview of paragraph types: how many paragraphs each type has, which fields allow it, and which types are used nowhere and can be deleted, with a direct link to delete them.
- Scan first, delete later: count the orphaned paragraphs and unused revisions of the types you select. Scanning never deletes anything.
- Safe cleanup: after you confirm, each paragraph is checked again and only deleted when no revision of its parent content uses it. Paragraphs used only by an older revision of the content are kept, so reverting content still works.
- Unused revisions: optionally delete old revisions of paragraphs that are still in use, to free space. The current content is not affected.
- Built for large sites: scanning and cleaning run in batches, in the browser or with Drush, so they do not time out.
- Drush commands to scan and clean, for scripts and scheduled maintenance, with table or CSV output.
- Restricted access: a dedicated permission, given to site administrators on update.
Orphans are detected with the same check as the Delete orphaned composite entities tool of Entity Reference Revisions, which cleans every composite entity type at once and without a report. Paragraph Cleanup adds a review per paragraph type before anything is deleted.
Requirements
- Drupal 10.3 or later, or Drupal 11.
- Paragraphs 1.17 or later.
- Entity Reference Revisions 1.12 or later.
Installation
Install as you would normally install a contributed Drupal module. For further information, see Installing Drupal Modules.
composer require drupal/paragraph_cleanup drush pm:enable paragraph_cleanup
Usage
- Give the Administer paragraph cleanup permission to the roles that may delete paragraphs.
- Go to Configuration » System » Paragraph cleanup (
/admin/content/paragraph-cleanup). - Select paragraph types and click Scan selected types. The table shows the orphaned paragraphs and unused revisions found. Nothing is deleted.
- Make a database backup, then click Delete orphans in selected types and confirm. Optionally, also delete unused revisions.
Support
Report bugs and request features in the issue queue.
Ask your assistant about Paragraph cleanup
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.