Skip to content

WP CLI

Installation

Homepage

sudo bash
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
mv wp-cli.phar /usr/bin/wp
chmod +x /usr/bin/wp
cd "your-wordpress-directory"
wp --info

Use Cases

Change Base URL

Wordpress stores the base url in more than one place, meaning it needs to be changed globally across multiple tables.

wp search-replace 'www.current.com' 'www.new.com' --skip-columns=guid

Change user password

wp user update USERNAME --user_pass="PASSWORD"

Clear cache

wp cache flush