Skip to content

WordCamp Toronto: Saving Time by Managing WordPress from the Command Line (WP-CLI)

Thank you to Melissa Jean Clark for snapping a few pictures during my talk.

On Sunday, I had the honour of getting to speak at WordCamp Toronto, a 2 day conference full of developers, designers, and users of the WordPress platform.  It was my first time giving this talk about the WP-CLI library, and I couldn’t have asked for a better audience.  My “talk” turned into more a group discussion.

The video of the talk will be online at some point, but in the meantime, you can see the slides here:

I also wanted to share  chunk of code that I used during the talk.  It’s my script to create a new WordPress installation from the command line, assuming you have permissions in MySQL to CREATE DATABASE.   I only recommend doing this in a development environment.

#!/bin/bash
wp core download
wp core config --dbuser=root --dbname=$1 --dbpass=vagrant
wp db create
wp core install --admin_user=wcto --admin_password=wcto --admin_email=me@example.com --title="WordCamp Toronto" --url=http://localhost/$1/

Running this script, for example:

./newsite demosite

from the command line will:

  1. Download the WordPress core
  2. Create a wp-config.php file
  3. Create a database using the connection details specified in step 2.
  4. Go the “5 minute” install of WordPress – in seconds.

Once this runs, you can login to your dashboard, you’re ready to go.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *