This plugin enables soft-delete functionality for Strapi v5 by adding a deletedAt timestamp field to your collection types, allowing entries to be marked as deleted without being permanently removed from the database.
released May 12, 2025
npm install strapi-plugin-soft-delete-contentsPowerful Strapi based Soft Delete feature, never loose content again
A plugin for Strapi Headless CMS that provides a Soft Delete feature.
This plugin was created by forking and enhancing the excellent Soft Delete plugin by ChristopheCVB. We're grateful for his foundational work that made this plugin possible. The original plugin has been migrated to newer Strapi versions and will be enhanced with additional features while maintaining the core functionality.
_softDeletedAt, _softDeletedById and _softDeletedByType fields to all your collection and single content types. Those fields are not visible in the Content Manager nor through the API._softDeletedAt to the current datetime, _softDeletedById to the action initiator id that deleted it and _softDeletedByType to the type of the delete action initiator.Delete is renamed to Soft Delete and it is located in the Settings > Roles > Edit a Role > Collection Types | Single Types section.Settings > Roles > Edit a Role > Collection Types | Single Types section. This is the Deleted Read permission. This will allow the admin role to view the soft deleted entries.Settings > Roles > Edit a Role > Collection Types | Single Types section. This is the Deleted Restore permission. This will allow the admin role to restore the soft deleted entries.Settings > Roles > Edit a Role > Collection Types | Single Types section. This is the Delete Permanently permission. This will allow the admin role to delete permanently the soft deleted entries.Settings > Roles > Edit a Role > Plugins > Soft Delete section. This is the global Read permission of the plugin. This will allow the admin role to view the Soft Delete item in the Admin left Panel. Accessing this will list all the content types the admin role has access to. They can restore or delete permanently the entries from here depending on the above permissions.Settings > Roles > Edit a Role > Plugins > Soft Delete section. This is the global Settings permission of the plugin. This will allow the admin role to view the Soft Delete plugin settings.Restore action. This will set the fields _softDeletedAt, _softDeletedById and _softDeletedByType to null.Delete Permanently action. This will delete the entry permanently from the databse.| Section | Permission | Description |
|---|---|---|
| Collection & Single Types | Deleted Restore | Allows the admin role to restore the soft deleted entries. |
| Collection & Single Types | Deleted Read | Allows the admin role to view the soft deleted entries. |
| Collection & Single Types | Delete Permanently | Allows the admin role to delete permanently the soft deleted entries. |
| Plugins | Read | Allows the admin role to view the Soft Delete item in the Admin left Panel. |
| Plugins | Settings | Allows the admin role to view the Soft Delete plugin settings. |
| Strapi Version | Plugin Version |
|---|---|
| ^5 | 1.0.4 |
| ^4 | Not Supported |
| ^3 | Not Supported |
Because of the way the plugin handles soft deleted entries, there are some caveats to be aware of:
beforeDelete, afterDelete, beforeDeleteMany and afterDeleteMany lifecycle hooks are not triggered when soft deleting entries. Instead, the beforeUpdate, afterUpdate, beforeUpdateMany and afterUpdateMany are. beforeDelete, afterDelete, beforeDeleteMany and afterDeleteMany lifecycle hooks are triggered when permanently deleting entries.To install this plugin, you need to add an NPM dependency to your Strapi application:
# Using Yarn
yarn add strapi-plugin-soft-delete
# Or using PNPM
pnpm add strapi-plugin-soft-delete
# Or using NPM
npm install strapi-plugin-soft-deleteEdit your config/plugins.js|ts or config/<env>/plugins.js|ts file and add the following configuration:
// ...
"soft-delete": {
enabled: true,
},
// ...Then, you'll need to build your admin panel:
# Using Yarn
yarn build
# Or using PNPM
pnpm run build
# Or using NPM
npm run buildFinally, start your application:
# Using Yarn
yarn develop
# Or using PNPM
pnpm run develop
# Or using NPM
npm run developFeel free to fork and make a PR if you want to add something or fix a bug.
_softDeletedAt field on API Content Types_softDeletedById field on API Content Types_softDeletedByType field on API Content Types_softDeleted* fields when deleting an entry upon delete or deleteMany methodsfind or findMany methodsTo uninstall this plugin, you need to remove the NPM dependency from your Strapi application:
# Using Yarn
yarn remove strapi-plugin-soft-delete
# Or using PNPM
pnpm remove strapi-plugin-soft-delete
# Or using NPM
npm uninstall strapi-plugin-soft-deleteEdit your config/plugins.js|ts or config/<env>/plugins.js|ts file and remove the following configuration:
// ...
"soft-delete": {
enabled: true,
},
// ...Also, if you have edited your API Content Types through the Content Builder, and because the plugin adds fields to it, you'll need to remove them from the schemas manually. The fields are:
_softDeletedAt_softDeletedById_softDeletedByTypeThen, you'll need to build your admin panel:
# Using Yarn
yarn build
# Or using PNPM
pnpm run build
# Or using NPM
npm run buildFinally, start your application:
# Using Yarn
yarn develop
# Or using PNPM
pnpm run develop
# Or using NPM
npm run developFor general help using Strapi, please refer to the official Strapi documentation. For additional help, you can use one of these channels to ask a question:
[MIT License]
Share your work with the community and get it listed in the Strapi ecosystem for everyone to discover and use.
Submit
