SlideShare a Scribd company logo
WP-CLI: Save Time by
Managing WordPress
from the Command Line
WordCamp Montreal, July 4, 2015	

!
Shawn Hooper, CTO,Actionable Books	

@shawnhooper - shawn@actionablebooks.com
• I’m Shawn Hooper, a web application
developer from Ottawa.
• I’ve been working in WordPress since
2009.
• I love the working from the command
prompt, reminds me of my days running
a BBS (in the days before the Internet)
Hi!
Command Line?!
• A set of command line tools that allows
you to manage WordPress from the
command line.

• http://www.wp-cli.org/
What is WP-CLI ?
• Anyone really, but mostly:
• Developers
• Theme Designers
• Server Administrators
Who is this for?
Don’t Fear The
Command Line
• http://www.wp-cli.org/
• Requires PHP 5.3.2 or later
• Requires WordPress 3.5.2 or later
• A “UNIX-like” environment:
• OSX (Macintosh)
• Linux
• Cygwin (Windows)
What do you need?
• You need to have SSH access to use
WP-CLI. Some shared hosting packages
do not allow SSH access
• PlanetHoster, SiteGround, Pantheon,
BlueHost, GoDaddy, Media Temple,
Windows Azure and more now have
CLI support.
• VPS services like Digital Ocean and
Linode are ideal.
Hosts
• Download it:

curl -O https://raw.githubusercontent.com/
wp-cli/builds/gh-pages/phar/wp-cli.phar

• Set permissions: 

chmod +x wp-cli.phar

• Move it somewhere useful:

sudo mv wp-cli.phar /usr/local/bin/wp 

Installing WP-CLI
• Does it work? Type:



wp

Installing WP-CLI
Installing WP-CLI
Congratulations!
(that was the hard part)
Great… It’s installed.
So now what….
wp <command> <sub-command> <params>
Running Commands:
<param> — required
[—param] — optional flag
[—param=<value>] — optional w/ value
Running Commands:
• Check current WordPress version, or
see if there are updates available.
• Do the update!
• Install a brand new site
• Convert an existing site to Multisite!
• Verify core checksums
core
• Let’s try setting up a brand new site on
a development server using:



wp core download

wp core config

wp db create

wp core install --prompt
core
• Install, Delete Plugins
• Activate & Deactivate Plugins
• Update Plugins
• Search the repository for plugins
plugin
• Time savers!



wp plugin update — all



wp plugin deactivate — all
plugin
The “db” command interacts with
the MySQL database.
!
wp db export backup.sql



wp db import backup.sql



wp db cli
db
• Safe Search & Replace, including
serialized arrays!

• Supports --dry-run
search-replace
Generate Test Content !
wp post generate --count=500
post
Regenerate Thumbnails
!
wp media regenerate —yes
media
Start an underscores theme!
!
wp scaffold _s mytheme
scaffold
… or a child theme
!
wp scaffold child-theme mychild
—parent_theme=twentyfourteen
scaffold
… or a custom post type
!
wp scaffold post-type mycpt —
theme
scaffold
Download & Activate a Theme
from WordPress.org
!
wp theme install simone —activate
theme
wp user generate
wp user import-csv
Create Users
wp term list
wp term create
wp term generate
Taxonomies
Executes PHP code

* after loading the WordPress Core *
eval & eval-file
Add any functionality you want
that isn’t already included in the
WP-CLI core.
https://github.com/wp-cli/wp-cli/
wiki/List-of-community-commands
Community
Commands
You can either write them as a
plugin, or include it using the

—require parameter

on the command line.
Community
Commands
Thank you!
!
E-Mail:
shawn@actionablebooks.com
!
!
Twitter: @shawnhooper
WordPress Slack: shooper

More Related Content

PDF
WP-CLI - WordCamp Miami 2015
PDF
Save Time by Managing WordPress from the Command Line
PPTX
A crash course in scaling wordpress
PPTX
WordPress.org & Optimizing Security for your WordPress sites
PDF
WordPress and The Command Line
PDF
Working in harmony
PPTX
WP-CLI: WordCamp Nashville 2016
PDF
SSDs are Awesome
WP-CLI - WordCamp Miami 2015
Save Time by Managing WordPress from the Command Line
A crash course in scaling wordpress
WordPress.org & Optimizing Security for your WordPress sites
WordPress and The Command Line
Working in harmony
WP-CLI: WordCamp Nashville 2016
SSDs are Awesome

What's hot (20)

PDF
Command Line WordPress with WP-CLI - WordPress Perth User Group
PDF
Command Line WordPress with WP-CLI
PDF
High Performance WordPress II
PDF
Week6 office-hours
PPTX
Don't worry with bower
PDF
Server Check.in case study - Drupal and Node.js
PPTX
Best Practices for WordPress in Enterprise
PDF
Working in Harmony: Manchester - Optimize development and content workflows
PDF
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI
PDF
High Performance Drupal
PPT
WordPress Fav Plugins & Security
PPTX
WordCamp Boston WordPress plugins-8-2014
PDF
WordPress Intermediate Workshop
PDF
Nürnberg WooCommerce Talk - 11/24/16
PDF
Liz Quilty – Security, Scaling & High End Hosting for WordPress sites
PPTX
WordPress Development Environments
PPT
ServerBeach and WordPress BlogWorldExpo 2007
PPT
High Performance WordPress
PPTX
Seawebperf 201207
PDF
Training Slides: Tungsten Replicator AMI - The Getting Started Guide
Command Line WordPress with WP-CLI - WordPress Perth User Group
Command Line WordPress with WP-CLI
High Performance WordPress II
Week6 office-hours
Don't worry with bower
Server Check.in case study - Drupal and Node.js
Best Practices for WordPress in Enterprise
Working in Harmony: Manchester - Optimize development and content workflows
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI
High Performance Drupal
WordPress Fav Plugins & Security
WordCamp Boston WordPress plugins-8-2014
WordPress Intermediate Workshop
Nürnberg WooCommerce Talk - 11/24/16
Liz Quilty – Security, Scaling & High End Hosting for WordPress sites
WordPress Development Environments
ServerBeach and WordPress BlogWorldExpo 2007
High Performance WordPress
Seawebperf 201207
Training Slides: Tungsten Replicator AMI - The Getting Started Guide
Ad

Similar to WP-CLI Talk from WordCamp Montreal (20)

PDF
WP-CLI Presentation from WordCamp NYC 2015
PDF
Manage WordPress From the Command Line with WP-CLI
PDF
Introduction to WP-CLI: Manage WordPress from the command line
PDF
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
PPTX
Aditya Shah - WPCLI - WordCamp Asia
PDF
Save Time By Manging WordPress from the Command Line
PDF
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
PPTX
WordPress CLI in-depth
PPTX
Take Command of WordPress With WP-CLI
PDF
Getting Started with WP-CLI, a tool to automate your life
PDF
The Themer's Guide to WP-CLI
ODP
Administer WordPress with WP-CLI
PPTX
Take Command of WordPress With WP-CLI at WordCamp Long Beach
PPTX
WP-CLI - A Good Friend of Developer
PPTX
Take Command of WordPress With WP-CLI
PDF
The Themer's Guide to WP-CLI
PDF
Workshop On WP-CLI
PDF
A Better WordPress Workflow with WP-CLI
PDF
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
PDF
Manage WordPress with Awesome using wp cli
WP-CLI Presentation from WordCamp NYC 2015
Manage WordPress From the Command Line with WP-CLI
Introduction to WP-CLI: Manage WordPress from the command line
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Aditya Shah - WPCLI - WordCamp Asia
Save Time By Manging WordPress from the Command Line
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
WordPress CLI in-depth
Take Command of WordPress With WP-CLI
Getting Started with WP-CLI, a tool to automate your life
The Themer's Guide to WP-CLI
Administer WordPress with WP-CLI
Take Command of WordPress With WP-CLI at WordCamp Long Beach
WP-CLI - A Good Friend of Developer
Take Command of WordPress With WP-CLI
The Themer's Guide to WP-CLI
Workshop On WP-CLI
A Better WordPress Workflow with WP-CLI
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
Manage WordPress with Awesome using wp cli
Ad

More from Shawn Hooper (12)

PDF
Introduction to WordPress Security
PDF
WP REST API: Actionable.co
PDF
Database Considerations for SaaS Products
PDF
Payments Made Easy with Stripe
PDF
WordPress Coding Standards & Best Practices
PDF
Writing Clean, Standards Compliant, Testable Code for WordPress
PPTX
Creating Multilingual WordPress Websites
PDF
Creating Multilingual WordPress Websites
PDF
Securing WordPress
PDF
Writing Secure Code for WordPress
PDF
Hooked on WordPress: WordCamp Columbus
PDF
Time Code: Automating Tasks in WordPress with WP-Cron
Introduction to WordPress Security
WP REST API: Actionable.co
Database Considerations for SaaS Products
Payments Made Easy with Stripe
WordPress Coding Standards & Best Practices
Writing Clean, Standards Compliant, Testable Code for WordPress
Creating Multilingual WordPress Websites
Creating Multilingual WordPress Websites
Securing WordPress
Writing Secure Code for WordPress
Hooked on WordPress: WordCamp Columbus
Time Code: Automating Tasks in WordPress with WP-Cron

WP-CLI Talk from WordCamp Montreal