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

!
Shawn Hooper

Chief Technology Officer,Actionable Books	

@shawnhooper - shawnhooper.ca
• 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!
@shawnhooper - shawnhooper.ca
Command Line?!
@shawnhooper - shawnhooper.ca
• 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 ?
@shawnhooper - shawnhooper.ca
• Anyone really, but mostly:
• Developers
• Theme Designers
• Server Administrators
Who is this for?
@shawnhooper - shawnhooper.ca
Don’t Fear The
Command Line
@shawnhooper - shawnhooper.ca
• 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?
@shawnhooper - shawnhooper.ca
• 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, Atlantic.net are ideal.
Hosts
@shawnhooper - shawnhooper.ca
• 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
@shawnhooper - shawnhooper.ca
• Does it work? Type:



wp

Installing WP-CLI
@shawnhooper - shawnhooper.ca
Installing WP-CLI
@shawnhooper - shawnhooper.ca
Congratulations!
(that was the hard part)
@shawnhooper - shawnhooper.ca
Great… It’s installed.
So now what….
@shawnhooper - shawnhooper.ca
wp <command> <sub-command> <params>
Running Commands:
@shawnhooper - shawnhooper.ca
<param> — required
[—param] — optional flag
[—param=<value>] — optional w/ value
Running Commands:
@shawnhooper - shawnhooper.ca
• 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
@shawnhooper - shawnhooper.ca
• 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
@shawnhooper - shawnhooper.ca
• Install, Delete Plugins
• Activate & Deactivate Plugins
• Update Plugins
• Search the repository for plugins
plugin
@shawnhooper - shawnhooper.ca
• Time savers!



wp plugin update — all



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



wp db import backup.sql



wp db cli
db
@shawnhooper - shawnhooper.ca
• Safe Search & Replace, including
serialized arrays!

• Supports --dry-run
search-replace
@shawnhooper - shawnhooper.ca
Generate Test Content !
wp post generate --count=500
post
@shawnhooper - shawnhooper.ca
Create Posts with Random
Content using Any Ipsum Plugin
!
wp plugin install any-ipsum —
activate

wp any-ipsum generate-posts 100
post
@shawnhooper - shawnhooper.ca
Regenerate Thumbnails
!
wp media regenerate —yes
media
@shawnhooper - shawnhooper.ca
Start an underscores theme!
!
wp scaffold _s mytheme
scaffold
@shawnhooper - shawnhooper.ca
… or a child theme
!
wp scaffold child-theme mychild
—parent_theme=twentyfourteen
scaffold
@shawnhooper - shawnhooper.ca
… or a custom post type
!
wp scaffold post-type mycpt —
theme
scaffold
@shawnhooper - shawnhooper.ca
Download & Activate a Theme
from WordPress.org
!
wp theme install simone —activate
theme
@shawnhooper - shawnhooper.ca
wp user generate
wp user import-csv
Create Users
@shawnhooper - shawnhooper.ca
wp term list
wp term create
wp term generate
Taxonomies
@shawnhooper - shawnhooper.ca
Executes PHP code

* after loading the WordPress Core *
eval & eval-file
@shawnhooper - shawnhooper.ca
wp role create
wp role list
wp role exists
!
new: —clone flag on create
role & cap
@shawnhooper - shawnhooper.ca
Launches PHP’s Built-in Web Server
!
wp server
server
@shawnhooper - shawnhooper.ca
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
@shawnhooper - shawnhooper.ca
You can either write them as a
plugin, or include it using the

—require parameter

on the command line.
Community
Commands
@shawnhooper - shawnhooper.ca
Thank you!

Slides: www.shawnhooper.ca

E-Mail: shawn@actionablebooks.com

Twitter: @shawnhooper

WordPress Slack: shooper
@shawnhooper - shawnhooper.ca

More Related Content

What's hot (20)

PPTX
Theming Wordpress for Your Showcases
Jun Hu
 
PDF
WordPress and The Command Line
Kelly Dwan
 
PPTX
Optimizing WordPress - WordPress SF Meetup April 2012
Ben Metcalfe
 
PDF
Desktop server presentation
Ken Kramer
 
PDF
Key learnings from hosting 1000+ WordPress sites
Thomas Audunhus
 
PDF
CPAN Dependency Heaven
OpusVL
 
PPTX
Saving Time with WP-CLI
Taylor Lovett
 
PDF
Best Practices for WordPress
Taylor Lovett
 
PPT
Wp cli-wcbalt
Aaron Brazell
 
PPT
Wp cli
Aaron Brazell
 
PPTX
Optimizing WordPress (WordCamp Philly 2011)
Ben Metcalfe
 
ODP
WordPress Security & Backup
Randy Barnes
 
PDF
Make your life easy with WP-CLI
Michael Corkum
 
PDF
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Bruce Li
 
PDF
My Website Can Vote - The Challenges of Maintaining a 20-year-old Website
Kristine Howard
 
PDF
You Got React.js in My PHP
Taylor Lovett
 
POT
Set up dev environment
ICourses Ottawa
 
PPTX
Wordpress installation
Webtech Learning
 
PPT
Creating Local WordPress Installs
mcgaritydotme
 
PDF
Server Check.in case study - Drupal and Node.js
Jeff Geerling
 
Theming Wordpress for Your Showcases
Jun Hu
 
WordPress and The Command Line
Kelly Dwan
 
Optimizing WordPress - WordPress SF Meetup April 2012
Ben Metcalfe
 
Desktop server presentation
Ken Kramer
 
Key learnings from hosting 1000+ WordPress sites
Thomas Audunhus
 
CPAN Dependency Heaven
OpusVL
 
Saving Time with WP-CLI
Taylor Lovett
 
Best Practices for WordPress
Taylor Lovett
 
Wp cli-wcbalt
Aaron Brazell
 
Optimizing WordPress (WordCamp Philly 2011)
Ben Metcalfe
 
WordPress Security & Backup
Randy Barnes
 
Make your life easy with WP-CLI
Michael Corkum
 
Make your Rails console AWESOME (Ruby SG meetup 2016-03-29)
Bruce Li
 
My Website Can Vote - The Challenges of Maintaining a 20-year-old Website
Kristine Howard
 
You Got React.js in My PHP
Taylor Lovett
 
Set up dev environment
ICourses Ottawa
 
Wordpress installation
Webtech Learning
 
Creating Local WordPress Installs
mcgaritydotme
 
Server Check.in case study - Drupal and Node.js
Jeff Geerling
 

Similar to Manage WordPress From the Command Line with WP-CLI (20)

PDF
WP-CLI - WordCamp Miami 2015
Shawn Hooper
 
PDF
WP-CLI Talk from WordCamp Montreal
Shawn Hooper
 
PDF
Save Time by Managing WordPress from the Command Line
Shawn Hooper
 
PPTX
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Diana Thompson
 
PPTX
Aditya Shah - WPCLI - WordCamp Asia
Aditya Shah
 
PPTX
Take Command of WordPress With WP-CLI
Diana Thompson
 
PDF
Getting Started with WP-CLI, a tool to automate your life
AJ Morris
 
PPTX
Take Command of WordPress With WP-CLI
Diana Thompson
 
PDF
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Andrea Cardinali
 
PPTX
Take Command of WordPress With WP-CLI
Diana Thompson
 
PDF
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
GetSource
 
PDF
Introduction to WP-CLI: Manage WordPress from the command line
Behzod Saidov
 
ODP
Administer WordPress with WP-CLI
Suwash Kunwar
 
PDF
The Themer's Guide to WP-CLI
Edmund Turbin
 
PPTX
WP-CLI - A Good Friend of Developer
Chandra Patel
 
PDF
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
ryanduff
 
PPTX
WordPress CLI in-depth
Sanjay Willie
 
PDF
Getting Started with WP-CLI
Christian Nolen
 
PDF
Manage WordPress with Awesome using wp cli
GetSource
 
PDF
A Better WordPress Workflow with WP-CLI
Rikesh Ramlochund
 
WP-CLI - WordCamp Miami 2015
Shawn Hooper
 
WP-CLI Talk from WordCamp Montreal
Shawn Hooper
 
Save Time by Managing WordPress from the Command Line
Shawn Hooper
 
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Diana Thompson
 
Aditya Shah - WPCLI - WordCamp Asia
Aditya Shah
 
Take Command of WordPress With WP-CLI
Diana Thompson
 
Getting Started with WP-CLI, a tool to automate your life
AJ Morris
 
Take Command of WordPress With WP-CLI
Diana Thompson
 
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Andrea Cardinali
 
Take Command of WordPress With WP-CLI
Diana Thompson
 
WordCamp Vancouver 2012 - Manage WordPress with Awesome using wp-cli
GetSource
 
Introduction to WP-CLI: Manage WordPress from the command line
Behzod Saidov
 
Administer WordPress with WP-CLI
Suwash Kunwar
 
The Themer's Guide to WP-CLI
Edmund Turbin
 
WP-CLI - A Good Friend of Developer
Chandra Patel
 
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
ryanduff
 
WordPress CLI in-depth
Sanjay Willie
 
Getting Started with WP-CLI
Christian Nolen
 
Manage WordPress with Awesome using wp cli
GetSource
 
A Better WordPress Workflow with WP-CLI
Rikesh Ramlochund
 
Ad

More from Shawn Hooper (12)

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

Recently uploaded (20)

PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 

Manage WordPress From the Command Line with WP-CLI

  • 1. WP-CLI: Save Time by Managing WordPress from the Command Line WordCamp Tampa 2015 ! Shawn Hooper
 Chief Technology Officer,Actionable Books @shawnhooper - shawnhooper.ca
  • 2. • 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! @shawnhooper - shawnhooper.ca
  • 4. • 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 ? @shawnhooper - shawnhooper.ca
  • 5. • Anyone really, but mostly: • Developers • Theme Designers • Server Administrators Who is this for? @shawnhooper - shawnhooper.ca
  • 6. Don’t Fear The Command Line @shawnhooper - shawnhooper.ca
  • 7. • 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? @shawnhooper - shawnhooper.ca
  • 8. • 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, Atlantic.net are ideal. Hosts @shawnhooper - shawnhooper.ca
  • 9. • 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 @shawnhooper - shawnhooper.ca
  • 10. • Does it work? Type:
 
 wp
 Installing WP-CLI @shawnhooper - shawnhooper.ca
  • 12. Congratulations! (that was the hard part) @shawnhooper - shawnhooper.ca
  • 13. Great… It’s installed. So now what…. @shawnhooper - shawnhooper.ca
  • 14. wp <command> <sub-command> <params> Running Commands: @shawnhooper - shawnhooper.ca
  • 15. <param> — required [—param] — optional flag [—param=<value>] — optional w/ value Running Commands: @shawnhooper - shawnhooper.ca
  • 16. • 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 @shawnhooper - shawnhooper.ca
  • 17. • 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 @shawnhooper - shawnhooper.ca
  • 18. • Install, Delete Plugins • Activate & Deactivate Plugins • Update Plugins • Search the repository for plugins plugin @shawnhooper - shawnhooper.ca
  • 19. • Time savers!
 
 wp plugin update — all
 
 wp plugin deactivate — all plugin @shawnhooper - shawnhooper.ca
  • 20. The “db” command interacts with the MySQL database. ! wp db export backup.sql
 
 wp db import backup.sql
 
 wp db cli db @shawnhooper - shawnhooper.ca
  • 21. • Safe Search & Replace, including serialized arrays!
 • Supports --dry-run search-replace @shawnhooper - shawnhooper.ca
  • 22. Generate Test Content ! wp post generate --count=500 post @shawnhooper - shawnhooper.ca
  • 23. Create Posts with Random Content using Any Ipsum Plugin ! wp plugin install any-ipsum — activate
 wp any-ipsum generate-posts 100 post @shawnhooper - shawnhooper.ca
  • 24. Regenerate Thumbnails ! wp media regenerate —yes media @shawnhooper - shawnhooper.ca
  • 25. Start an underscores theme! ! wp scaffold _s mytheme scaffold @shawnhooper - shawnhooper.ca
  • 26. … or a child theme ! wp scaffold child-theme mychild —parent_theme=twentyfourteen scaffold @shawnhooper - shawnhooper.ca
  • 27. … or a custom post type ! wp scaffold post-type mycpt — theme scaffold @shawnhooper - shawnhooper.ca
  • 28. Download & Activate a Theme from WordPress.org ! wp theme install simone —activate theme @shawnhooper - shawnhooper.ca
  • 29. wp user generate wp user import-csv Create Users @shawnhooper - shawnhooper.ca
  • 30. wp term list wp term create wp term generate Taxonomies @shawnhooper - shawnhooper.ca
  • 31. Executes PHP code
 * after loading the WordPress Core * eval & eval-file @shawnhooper - shawnhooper.ca
  • 32. wp role create wp role list wp role exists ! new: —clone flag on create role & cap @shawnhooper - shawnhooper.ca
  • 33. Launches PHP’s Built-in Web Server ! wp server server @shawnhooper - shawnhooper.ca
  • 34. 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 @shawnhooper - shawnhooper.ca
  • 35. You can either write them as a plugin, or include it using the
 —require parameter
 on the command line. Community Commands @shawnhooper - shawnhooper.ca
  • 36. Thank you!
 Slides: www.shawnhooper.ca
 E-Mail: [email protected]
 Twitter: @shawnhooper
 WordPress Slack: shooper @shawnhooper - shawnhooper.ca