Skip to content

WP-CLI ​

The commands use the same filters, protections and log as the admin page. Run them as an administrator with --user.

bash
wp help ubdwp

wp ubdwp find ​

Lists the users that match the filters, without deleting anything.

bash
wp ubdwp find --role=subscriber --meta-key=first_name --meta-compare=empty --format=count --user=admin
wp ubdwp find --email=@example.com --email-compare=ends-with --user=admin
wp ubdwp find --products=12,15 --format=count --user=admin
OptionDescription
--ids=<ids>Comma-separated user IDs, or all for all users of the site
--role=<roles>Comma-separated roles
--email=<value>Email value to compare
--email-compare=<compare>equal (default), not-equal, like, not-like, ends-with
--registered=<date>Registration date, YYYY-MM-DD, site timezone
--registered-compare=<compare>after (default), before, on, between
--registered-to=<date>End date for between
--meta-key=<key>User meta key
--meta-compare=<compare>not-exists, empty, equal (default), not-equal, like, not-like, equal-date, not-equal-date, less-date, less-equal-date, greater-date, greater-equal-date, equal-number, not-equal-number, less-number, less-equal-number, greater-number, greater-equal-number
--meta-value=<value>User meta value to compare
--without-contentOnly users without posts or comments on the site
--without-ordersOnly users without WooCommerce orders
--products=<ids>Customers who bought one of these WooCommerce products
--any-productCustomers who bought any WooCommerce product
--format=<format>table (default), csv, json, ids, count

wp ubdwp delete ​

Deletes the users that match the filters (on multisite: removes them from the site). Shows a summary first; protected users and users you cannot delete are skipped. Takes every filter of find, plus:

OptionDescription
--reassign=<user>User ID that receives the content, or remove-content to delete posts and comments permanently. Without it, WordPress core behavior applies.
--batch-size=<number>Users deleted per batch
--dry-runOnly show the summary
--yesDo not ask for confirmation
--backgroundCreate a background job instead of deleting now
bash
wp ubdwp delete --role=subscriber --meta-key=first_name --meta-compare=empty --dry-run --user=admin
wp ubdwp delete --ids=12,15 --reassign=remove-content --yes --user=admin
wp ubdwp delete --role=subscriber --without-content --background --yes --user=admin

wp ubdwp jobs ​

Lists, runs or cancels deletion jobs.

bash
wp ubdwp jobs --user=admin
wp ubdwp jobs run 12 --user=admin
wp ubdwp jobs cancel 12 --user=admin

--format=table|csv|json for the list.

wp ubdwp logs ​

bash
wp ubdwp logs purge --older-than=90 --user=admin   # delete entries older than 90 days
wp ubdwp logs purge --all --yes --user=admin       # delete the whole log
wp ubdwp logs anonymize --yes --user=admin         # apply the email privacy setting to existing entries

The free plugin is released under the GPL v2 or later. The Pro add-on is sold through Freemius.