Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wp-mail-logging domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /mnt/serverpilot1_srv/shawnhooper/apps/shawn-hooper/public/wp-includes/functions.php on line 6114
WordCamp Toronto: Managing WordPress with WP-CLI 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.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.