WordPress CLI

less than 1 minute read

Description:

As someone who is always messing up my WordPress site, I found a neat tool that can help me get my site back without messing with PHPMyAdmin. It’s called wp-cli and many people swear by it.

To Resolve:

  1. First step is to download and install it:

sudo curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
sudo chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp –info #gets info on your install and makes sure it’s working
wp cli update

  1. Now for the real power! I can get my site back in a few commands:

wp search-replace ‘example.dev’ ‘example.com’ –skip-columns=guid
#or
wp option update home ‘http://example.com’
wp option update siteurl ‘http://example.com’
#if you want to see your current site URL, type:
wp option get siteurl