
Node Cleanup is a contributed admin tool that allows site administrators to:
The most important feature:
Only unpublished nodes are deleted.
On large Drupal sites, content clutter becomes a serious maintenance issue:
What is Node Cleanup?
The module is:
- Filter nodes by Content Type
- Filter by Published / Unpublished Status
- View nodes in a structured admin table
- Bulk delete only unpublished nodes
Your workflow slows down, and teams need more time to clean things up. And although Drupal’s content page is powerful, a quick, bulk cleanup at scale can be a huge time saver!
- Simple and lightweight
- Built using Drupal 10/11 best practices
- Dependency-injection compliant
- Focused on performance and simplicity
Why do you need this module
$query = $this->entityTypeManager
->getStorage('node')
->getQuery()
->accessCheck(FALSE);
Even if a published node is selected accidentally, it will not be removed.
Node Cleanup provides a dedicated, focused interface for fast and safe content cleanup.
Where does it appear?
✔ Filter nodes by content type
✔ Filter by published/unpublished status
✔ View results in a structured table select format
✔ Delete multiple unpublished nodes safely
Node Cleanup is a lightweight tool designed for Drupal 10/11 to help remove unpublished content easily. In this blog, I shall walk you through this contributed module, why you need it, the problems it solves for you, and how it works.
Cleaning up cluttered content need not be a hassle anymore. With the Node Cleanup module, content admins can rest easy. This simple yet powerful administrative utility for Drupal 10 and 11 helps improve content hygiene, save admin time, and prevent accidental deletions, all while following Drupal coding best practices.
What problem does it solve?
The module retrieves nodes using Drupal’s Entity Query API, ensuring:
- Drafts pile up
- Test nodes remain forgotten
- Migration leftovers increase the database size
- Admin time is wasted on repetitive deletion tasks
That’s where Node Cleanup comes in.
While Drupal’s core Content listing works well, it isn’t optimized for bulk cleanup operations.
How it works (Technical Overview)
1. Uses Entity Query API (Not Direct SQL)
Admin/Content/Node Cleanup
If your Drupal site accumulates unpublished content regularly, this module is a practical and efficient solution.
2. Dynamic Content Type Loading
It extends the core content administration area without altering existing workflows.
- Default content types
- Custom bundles
- Future content types
3. Tableselect Interface for Bulk Operations
All content types are loaded dynamically using the Entity Type Manager.
- Linked node titles
- Bundle information
- Status display
- Multi-select checkboxes
Below is how you would see the admin UI of the Node Cleanup module once you implement it in your workflow:
4. Safe Deletion Logic
Nodes are displayed using Drupal’s #tableselect form element, giving administrators:
This ensures a native and familiar Drupal admin experience.
Node Cleanup solves this by offering a centralized interface to:
if (!$node->isPublished()) {
$node->delete();
}
The module integrates seamlessly into the admin UI:
Final thoughts
In real-world Drupal environments, you’ll often encounter:
Things getting messy in the technical world of Drupal is quite common. Whether it’s migration leftovers, abandoned drafts, or test content from staging, things easily pile up in the background, making it challenging for the content admin.



