How to Bulk Delete Drupal Nodes with Devel PHP Instead of Using Delete All
Joan Català presents a practical alternative to the Delete All
module by leveraging Devel
and Devel PHP
modules to mass-delete Drupal nodes via custom PHP. The article targets advanced users comfortable executing code within Drupal’s admin interface.
The tutorial includes exact commands to download and extract module tarballs, though it assumes manual installation without Composer. Once Devel PHP is enabled, users can input and execute PHP snippets directly from the admin interface. Joan provides two examples to bulk delete nodes of type "article" using \Drupal::entityTypeManager()
.
While effective for quick cleanup or testing, this method bypasses access checks and is risky for production use. The article lacks warnings or rollback guidance, making it unsuitable for beginners or critical environments. Still, it's a concise and focused technique for developers managing large volumes of test content.