Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module provides a way to automatically delete old content from your Drupal site based on criteria you define, like deleting nodes older than a certain date. It can also be used to purge other entity types or specific items like abandoned shopping carts.

The Entity Purge modules provides a system for purging Drupal entities. For example, daily delete all entities of type X that are older than 1 month.

Features

  • It provides a purge plugin that allows you to delete during cron entities based on their age.
  • For Commerce users, it provides a purge plugin that allows you to delete Commerce carts during cron based on their creation time.
  • Custom plugins can be written that can collect the entities to be deleted based on custom criteria.
  • Automated unit tests, so that you can sleep at night.

Usage

Currently, there is no UI. Configuration entities must be created by a developer and imported via Drush or the config UI.

As an example, to delete all nodes older than 45 days, create a file at "config/sync/entity_purge.type.my_app_old_nodes.yml" with the following content. You may change the ID of the purge type from "my_app_old_nodes" to whatever suits your case.

langcode: en
# Purges for types disabled here will not be executed. 
status: true
dependencies:
  module:
    - node
id: my_app_old_nodes
label: 'Old content items'
description: 'Purges content items older than 45 days, 200 at a time.'
plugin_id: age
plugin_config:
  # Enable debugging for testing. No entities will be deleted.
  # Use with logging enabled.
  # debug: true
  # Enable logging to monitor which entities are being deleted.
  # log: true
  # Purges will be automatically run via cron. Set to `custom`
  # if you want to call the purger yourself in your code. 
  scheduler: cron
  entity_type_id: node
  # Change to `changed` to delete nodes based on their last
  # updated time. 
  field_name: created
  # Minimum age in seconds; nodes older than this will be
  # deleted.
  min_age: 3888000
  # Do not increase this limit too much. Rather, if you have
  # too many items regularly generated - such as logs,
  # set the cron to run more frequently using a module like
  # Ultimate Cron.
  limit: 200

Import the configuration, then export it so that you get the uuid property assigned by the system.

Additional Requirements

This module only requires Drupal core versions 9+, and PHP 8+.

Supporting this Module

Create issues in the Drupal.org queue, submit MRs. If you are interested in sponsoring this module to add more features, contact the module maintainers.

Activity

Total releases
2
First release
Jun 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Dormant

Releases

Version Type Release date
1.0.0-beta4 Pre-release Jun 24, 2025
1.0.0-beta3 Pre-release Jun 24, 2025