Trash Comment
Part of the Trash ecosystem · 5 projects
This module allows comments to be soft-deleted, meaning they are hidden but can be restored, while remaining in their original position in a thread with a placeholder message. This preserves the visual structure and reply chains of comment threads.
About
Deleting a comment in Drupal core is permanent, and it takes every reply below it along with it. That makes moderation risky: removing one bad comment can silently destroy an entire discussion, and there is no way back.
Trash Comment extends the Trash module to comments. A deleted comment is soft-deleted instead of destroyed: it stays in the thread as a neutral placeholder reading "This comment has been deleted", so nested replies remain visible and correctly connected. The original comment can be restored at any time from the Trash overview. This is the behaviour people already know from platforms such as Reddit, YouTube or GitHub.
Features
- Soft-delete for comments — trashed comments are hidden from regular display but stay in the database and can be restored at any time.
- Thread-preserving placeholders — deleted comments keep their position in the thread, so nested replies stay visually connected.
- Trash admin integration — comment types appear in the Trash settings form, so soft-deletion can be enabled per comment type.
- Access control — trashed comments cannot be edited or deleted through the UI, preventing accidental changes to content that is waiting to be restored.
- Inspect deleted content — users with the View deleted entities permission see the original comment instead of the placeholder when viewing a page in trash context.
- No custom database tables — built entirely on the entity API and the Trash module's own hooks.
Requirements
- Drupal 11.1 or newer — the module uses attribute-based hook discovery, which core added in 11.1.
- PHP 8.3 or newer
- Trash 3.0.30 or newer
- Comment (Drupal core)
Getting started
Install the module with composer require drupal/trash_comment and enable it. Then go to Configuration > Content authoring > Trash (/admin/config/content/trash) and enable the Comment entity type. Optionally restrict soft-deletion to individual comment types; if none are selected, all comment types are covered.
From that point on, deleting a comment moves it to the trash instead of removing it. Trashed comments are listed under Content > Trash (/admin/content/trash), where they can be restored or purged.
Depends on
Dependencies of the latest stable release
- Trash
- comment Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Trash ecosystem
Most installed first
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 1.0.2 | Stable | 11 | Minor clean ups | Aug 28, 2026 | |
| 1.0.1 | Stable | 11 | Jun 22, 2026 | ||
| 1.0.0 | Stable | 10–11 | Jun 11, 2026 | ||
| 1.0.0-alpha1 | Pre-release | 10–11 | Mar 10, 2026 |