定制 pvtl/wp-safe-user-deletion 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pvtl/wp-safe-user-deletion

Composer 安装命令:

composer require pvtl/wp-safe-user-deletion

包简介

A must-use WordPress plugin that adds a double confirmation when deleting users and blocks deletion if the user has content that has not been reassigned to another user.

README 文档

README

A must-use WordPress plugin that adds a double confirmation when deleting users and blocks deletion if the user has content that has not been reassigned to another user.

Why we created this plugin

Deleting a WordPress user who has authored posts, pages, or other content can permanently delete that content if an administrator chooses "Delete all content" instead of "Attribute all content to" another user. This is easy to do by mistake: the confirmation screen presents both options, and a quick click can lead to irreversible data loss.

We created WP Safe User Deletion to:

  • Reduce accidental data loss when removing users (e.g. former staff or contributors).
  • Make the reassignment option obvious so admins are encouraged to assign content to another user before deleting.
  • Enforce a safety check so deletion is blocked when the user has content and no reassignment was selected.

What this plugin prevents

  • Permanent loss of posts and pages – Content authored by the deleted user is no longer lost by mistake when an admin forgets to choose "Attribute all content to".
  • Orphaned or deleted custom content – The same protection applies to any post type that supports author (e.g. custom post types like job profiles).
  • Rushed deletions – An extra confirmation step when "Delete all content" is selected gives admins a chance to cancel and reassign instead.

The plugin does not prevent deletion when:

  • The user has no content (posts, pages, or links), or
  • The admin has chosen "Attribute all content to" and selected another user.

In those cases, deletion proceeds as normal.

How it works

  1. On the delete confirmation screen (Users → Delete on a user), an admin notice reminds the admin to choose a user to assign content to before deleting, so no data is lost.
  2. Before submitting the form, if the admin selects "Delete all content", a browser confirmation dialog appears warning that the user has content and suggesting they assign it to another user. They can cancel to go back and choose "Attribute all content to".
  3. When deletion is requested, the plugin checks whether the user being deleted has any content (posts of any type or, if the link manager is enabled, links). If they do, and no reassignment was selected, the deletion is blocked and the admin sees a clear message with a link back to the Users list to try again and select a reassignment user.

This plugin works with WordPress's built-in user delete flow; it does not add new admin pages or change how you delete users, only adds notices and guards.

What counts as "content"

  • Posts and pages – Any post type that supports the author field (posts, pages, and custom post types such as job profiles).
  • Links – If the site has the link manager enabled, links owned by the user are also considered content.

If the user has at least one such item, deletion is blocked until content is reassigned (or the user is deleted via the reassign option).

Requirements

  • WordPress (tested with modern versions; uses standard hooks and APIs).
  • No additional PHP extensions or Composer dependencies.
  • Installed as a must-use plugin (mu-plugins); it is always active and does not appear in the Plugins list.

Installation

Composer / Wordpress Bedrock

composer require pvtl/wp-safe-user-deletion

Manual

  1. Upload plugin to wp-content/plugins/wp-safe-user-deletion/
  2. Activate plugin in WordPress admin

Author

Pivotal Agency Pty Ltd

License

MIT

pvtl/wp-safe-user-deletion 适用场景与选型建议

pvtl/wp-safe-user-deletion 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 41 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 pvtl/wp-safe-user-deletion 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 pvtl/wp-safe-user-deletion 我们能提供哪些服务?
定制开发 / 二次开发

基于 pvtl/wp-safe-user-deletion 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 41
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 25
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Public
  • 更新时间: 2026-02-26