brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp user create adds a wordpress account with a role, --porcelain prints the ID

WordPress
~/tips/tip-wordpress-user-create-role-porcelain

wp user create anna [email protected] --role=editor --porcelain

Adds a user with a chosen role from the terminal and prints only the new ID.

Creating a user through the dashboard is slow when you have to do it on several sites.

wp user create anna [email protected] --role=editor --porcelain

The first two arguments are the login and the email address. --role sets the role, and without it the default role of the site applies. --porcelain prints only the new user ID, which is handy in a script. Without --user_pass WP-CLI generates a random password, and without --send-email the new user gets no mail, so you have to pass the login details on yourself. Shell history keeps the command, so avoid typing a real password on the line.

Further reading: WP-CLI: wp user create

More WordPress tips wp user application-password create anna backup-script --porcelain define( 'MEDIA_TRASH', true ); wp cli check-update wp theme delete --all wp media image-size All WordPress tips (85) All topics

Link