How to Bulk Delete Drupal Nodes with Devel PHP Instead of Using Delete All

Setting Up Drupal with PHP-FPM and Nginx on Ubuntu

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.

Source Reference

Date of Publication

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related People

Upcoming Events

Latest Opportunities