WP CLI just changed my life – Admin wordpress sites from the command line

Apr 20th, 2017 | By | Category: Linux / Freebsd, wordpress

I’ve installed somewhere between 300-500 wordpress sites in my life and I have no idea how I hadn’t heard of WP CLI until now but man oh man this thing is awesome.  Never again have to log into an admin site to do updates and maintenance because WP CLI is here.

First off, head over to http://wp-cli.org/ for general info.

To install it do the following steps:

  1. curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  2. php wp-cli.phar –info  (make sure it is working properly)
  3. chmod +x wp-cli.phar (make it writable)
  4. sudo mv wp-cli.phar /usr/local/bin/wp (move it to a globally accessible dir)
  5. wp –info (test it again)

And you’re good.  Some useful commands are:

  • wp cli update
  • wp search-replace

 

Tab completions

WP-CLI also comes with a tab completion script for Bash and ZSH. Just download wp-completion.bash and source it from ~/.bash_profile:

source /FULL/PATH/TO/wp-completion.bash

Don’t forget to run source ~/.bash_profile afterwards

Tags: , , ,

Leave a Comment