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:

    1
    2
    3
    4
    5
    6
    
    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  
    # The following gets info on your install and makes sure it is working
    wp info   
    wp cli update
    
  2. Now for the real power! I can get my site back in a few commands:

    1
    2
    3
    4
    5
    6
    
    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
    

Comments