WP CLI Tips And Tricks

Rename wordpress database prefix (https://iandunn.name/2016/07/21/rename-wordpress-database-prefix-with-w…)

Change site URL:

wp search-replace 'example.dev' 'example.com' --skip-columns=guid
Or, if you only want to change the option, you can do:

wp option update home 'http://example.com'
wp option update siteurl 'http://example.com'

Install and activate plugin example: wp plugin install really-simple-ssl --activate

Check users: wp user list

Reset password: wp user update USERNAME --user_pass="PASSWORD" (https://developer.wordpress.org/cli/commands/user/reset-password/)

Update user e-mail: sudou.bash wp user update USERNAME --user_email=EMAIL

Reset database: wp db reset --yes (https://developer.wordpress.org/cli/commands/db/reset/)

Import database: wp db import wordpress_dbase.sql

Delete all inactive themes: https://guides.wp-bullet.com/autodelete-unused-inactive-wordpress-theme…

Delete all inactive plugins and themes: https://github.com/wp-cli/wp-cli/issues/1954

Flush all: https://wordpress.stackexchange.com/questions/358362/how-to-remove-all-…

 

Genereal documentation: https://developer.wordpress.org/cli/commands/ and https://wp-cli.org/

Last modified
2021-07-28
Tags