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

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

  1. Give the Administer paragraph cleanup permission to the roles that may delete paragraphs.
  2. Go to Configuration » System » Paragraph cleanup (/admin/content/paragraph-cleanup).
  3. Select paragraph types and click Scan selected types. The table shows the orphaned paragraphs and unused revisions found. Nothing is deleted.
  4. 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.

Supporting organizations: 
Supports in Development

Project information

Releases