WP-CLI Network Users
WP-CLI commands for managing users across a WordPress Multisite network.
by Ian Dunn · github.com/iandunn/wp-cli-network-users · website
★ 1stars
1.1kcomposer installs
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/iandunn/wp-cli-network-users/archive/refs/heads/main.zipAlso on Packagist as iandunn/wp-cli-network-users:
composer require iandunn/wp-cli-network-usersFrom the readme
WP-CLI Network Users
WP-CLI commands for managing users across a WordPress Multisite network.
Provides wp user delete-network and wp user set-role-network. Both can be applied to users who haven't been active in the past n days, or who have never been active.
"Active" just means that they've logged in during the given time period.
Simpler Alternatives
For simple cases, the built-in WP-CLI commands and a little plumbing is enough:
Use this if you want:
- Inactivity targeting — bulk-target users who haven't logged in within n days, or ever since the plugin was installed (--inactive= / --inactive=never)
- Speed on large networks - this is much faster than the wp site list... loop, because it only acts on sites the user is already on, and doesn't re-load WP for every site
- Flexible site targeting — --sites=current updates only sites the user already belongs to; --sites=all adds them to every site; or target specific sites by ID or URL
- Multiple users at once — comma-separated IDs, usernames, or emails in a single command
- Dry-run preview — see who would be affected before committing (--dry-run)
- VIP-aware inactivity — automatically incorporates WordPress VIP's wpviplastseen