WP-CLI: Save Time
by Managing
WordPress from the
Command Line
WordCamp Miami	

May 30, 2015	

@shawnhooper
• I’m Shawn Hooper, a web application
developer from Ottawa, Canada.
• 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 3.5.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
• 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@fivesense.ca
Twitter: @shawnhooper
!
www.shawnhooper.ca

More Related Content

PDF
WP-CLI Talk from WordCamp Montreal
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
Command Line WordPress with WP-CLI - WordPress Perth User Group
PDF
Command Line WordPress with WP-CLI
PDF
High Performance WordPress II
WP-CLI Talk from WordCamp Montreal
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
Command Line WordPress with WP-CLI - WordPress Perth User Group
Command Line WordPress with WP-CLI
High Performance WordPress II

What's hot (20)

PDF
SSDs are Awesome
PPTX
WP-CLI: WordCamp Nashville 2016
PDF
Week6 office-hours
PPTX
Ryan Duff 2015 WordCamp US HTTP API
PDF
Working in harmony
ZIP
High Performance WordPress - WordCamp Jerusalem 2010
PPT
Extending Your WordPress Toolbelt with WP-CLI
PDF
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
PPTX
Managing Multisite: Lessons from a Large Network
PPTX
Don't worry with bower
PPT
WordPress Fav Plugins & Security
PPT
ServerBeach and WordPress BlogWorldExpo 2007
PPT
High Performance WordPress
PPTX
WordCamp Boston WordPress plugins-8-2014
PDF
Liz Quilty – Security, Scaling & High End Hosting for WordPress sites
PPTX
WP-CLI - A Good Friend of Developer
PPT
WP-MU 101: How to Install and Avoid Common Mistakes
PDF
Making Magic with WP-CLI
PPTX
Wordpress vs Google Blogger/ Wampserver
PDF
Server Check.in case study - Drupal and Node.js
SSDs are Awesome
WP-CLI: WordCamp Nashville 2016
Week6 office-hours
Ryan Duff 2015 WordCamp US HTTP API
Working in harmony
High Performance WordPress - WordCamp Jerusalem 2010
Extending Your WordPress Toolbelt with WP-CLI
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
Managing Multisite: Lessons from a Large Network
Don't worry with bower
WordPress Fav Plugins & Security
ServerBeach and WordPress BlogWorldExpo 2007
High Performance WordPress
WordCamp Boston WordPress plugins-8-2014
Liz Quilty – Security, Scaling & High End Hosting for WordPress sites
WP-CLI - A Good Friend of Developer
WP-MU 101: How to Install and Avoid Common Mistakes
Making Magic with WP-CLI
Wordpress vs Google Blogger/ Wampserver
Server Check.in case study - Drupal and Node.js

Similar to WP-CLI - WordCamp Miami 2015 (20)

PDF
WP-CLI Presentation from WordCamp NYC 2015
PDF
Manage WordPress From the Command Line with WP-CLI
PDF
Building the next generation of themes with WP Rig 2.0
PPTX
WordPress CLI in-depth
ODP
Administer WordPress with WP-CLI
PPTX
Battling the WSOD - A Tech Support Tale
PPTX
Wordpress website development
PPTX
WordPress Plugins and Security
KEY
Productivity 101: Making a Easily Re-deployable Dev Environment with Subversion
PDF
Working in Harmony: Manchester - Optimize development and content workflows
KEY
Wordpress 101 presentation - Canadian Association of Labour Media (CALM)
PPTX
WP 101 - Local Development - Themes and Plugins
PDF
Rapid WordPress theme development
PDF
The WP Engine Developer Experience. Increased agility, improved efficiency.
PDF
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
PPTX
WordCamp Kent 2019 - WP 101: Local Development - Themes and Plugins
PDF
WordPress Intermediate Workshop
PPTX
Saving Time with WP-CLI
PDF
The WordPress Way
PPTX
WordPress Security and Best Practices
WP-CLI Presentation from WordCamp NYC 2015
Manage WordPress From the Command Line with WP-CLI
Building the next generation of themes with WP Rig 2.0
WordPress CLI in-depth
Administer WordPress with WP-CLI
Battling the WSOD - A Tech Support Tale
Wordpress website development
WordPress Plugins and Security
Productivity 101: Making a Easily Re-deployable Dev Environment with Subversion
Working in Harmony: Manchester - Optimize development and content workflows
Wordpress 101 presentation - Canadian Association of Labour Media (CALM)
WP 101 - Local Development - Themes and Plugins
Rapid WordPress theme development
The WP Engine Developer Experience. Increased agility, improved efficiency.
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
WordCamp Kent 2019 - WP 101: Local Development - Themes and Plugins
WordPress Intermediate Workshop
Saving Time with WP-CLI
The WordPress Way
WordPress Security and Best Practices

More from Shawn Hooper (13)

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
Save Time By Manging WordPress from the Command Line
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
Save Time By Manging WordPress from the Command Line
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

Recently uploaded (20)

PDF
State of AI in Business 2025 - MIT NANDA
PDF
Applying Agentic AI in Enterprise Automation
PPTX
From Curiosity to ROI — Cost-Benefit Analysis of Agentic Automation [3/6]
PPTX
Information-Technology-in-Human-Society.pptx
PDF
Addressing the challenges of harmonizing law and artificial intelligence tech...
PDF
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
PPT
Overviiew on Intellectual property right
PDF
Advancements in abstractive text summarization: a deep learning approach
PPTX
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
PDF
FASHION-DRIVEN TEXTILES AS A CRYSTAL OF A NEW STREAM FOR STAKEHOLDER CAPITALI...
PDF
NewMind AI Journal Monthly Chronicles - August 2025
PDF
Decision Optimization - From Theory to Practice
PPTX
CRM(Customer Relationship Managmnet) Presentation
PPTX
maintenance powerrpoint for adaprive and preventive
PDF
Be ready for tomorrow’s needs with a longer-lasting, higher-performing PC
PDF
Intravenous drug administration application for pediatric patients via augmen...
PDF
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
PDF
Domain-specific knowledge and context in large language models: challenges, c...
PDF
Revolutionizing recommendations a survey: a comprehensive exploration of mode...
PDF
Slides World Game (s) Great Redesign Eco Economic Epochs.pdf
State of AI in Business 2025 - MIT NANDA
Applying Agentic AI in Enterprise Automation
From Curiosity to ROI — Cost-Benefit Analysis of Agentic Automation [3/6]
Information-Technology-in-Human-Society.pptx
Addressing the challenges of harmonizing law and artificial intelligence tech...
CCUS-as-the-Missing-Link-to-Net-Zero_AksCurious.pdf
Overviiew on Intellectual property right
Advancements in abstractive text summarization: a deep learning approach
Rise of the Digital Control Grid Zeee Media and Hope and Tivon FTWProject.com
FASHION-DRIVEN TEXTILES AS A CRYSTAL OF A NEW STREAM FOR STAKEHOLDER CAPITALI...
NewMind AI Journal Monthly Chronicles - August 2025
Decision Optimization - From Theory to Practice
CRM(Customer Relationship Managmnet) Presentation
maintenance powerrpoint for adaprive and preventive
Be ready for tomorrow’s needs with a longer-lasting, higher-performing PC
Intravenous drug administration application for pediatric patients via augmen...
GDG Cloud Southlake #45: Patrick Debois: The Impact of GenAI on Development a...
Domain-specific knowledge and context in large language models: challenges, c...
Revolutionizing recommendations a survey: a comprehensive exploration of mode...
Slides World Game (s) Great Redesign Eco Economic Epochs.pdf

WP-CLI - WordCamp Miami 2015

  • 1. WP-CLI: Save Time by Managing WordPress from the Command Line WordCamp Miami May 30, 2015 @shawnhooper
  • 2. • I’m Shawn Hooper, a web application developer from Ottawa, Canada. • 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!
  • 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 ?
  • 5. • Anyone really, but mostly: • Developers • Theme Designers • Server Administrators Who is this for?
  • 7. • http://www.wp-cli.org/ • Requires PHP 3.5.2 or later • Requires WordPress 3.5.2 or later • A “UNIX-like” environment: • OSX (Macintosh) • Linux • Cygwin (Windows) What do you need?
  • 8. • You need to have SSH access to use WP-CLI. Some shared hosting packages do not allow SSH access • SiteGround, Pantheon, BlueHost, GoDaddy, Media Temple, Windows Azure and more now have CLI support. • VPS services like Digital Ocean and Linode are ideal. Hosts
  • 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
  • 10. • Does it work? Type:
 
 wp
 Installing WP-CLI
  • 14. wp <command> <sub-command> <params> Running Commands:
  • 15. <param> — required [—param] — optional flag [—param=<value>] — optional w/ value Running Commands:
  • 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
  • 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
  • 18. • Install, Delete Plugins • Activate & Deactivate Plugins • Update Plugins • Search the repository for plugins plugin
  • 19. • Time savers!
 
 wp plugin update — all
 
 wp plugin deactivate — all plugin
  • 20. The “db” command interacts with the MySQL database. ! wp db export backup.sql
 
 wp db import backup.sql
 
 wp db cli db
  • 21. • Safe Search & Replace, including serialized arrays!
 • Supports --dry-run search-replace
  • 22. Generate Test Content ! wp post generate --count=500 post
  • 23. Regenerate Thumbnails ! wp media regenerate —yes media
  • 24. Start an underscores theme! ! wp scaffold _s mytheme scaffold
  • 25. … or a child theme ! wp scaffold child-theme mychild —parent_theme=twentyfourteen scaffold
  • 26. … or a custom post type ! wp scaffold post-type mycpt — theme scaffold
  • 27. Download & Activate a Theme from WordPress.org ! wp theme install simone —activate theme
  • 28. wp user generate wp user import-csv Create Users
  • 29. wp term list wp term create wp term generate Taxonomies
  • 30. Executes PHP code
 * after loading the WordPress Core * eval & eval-file
  • 31. 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
  • 32. You can either write them as a plugin, or include it using the
 —require parameter
 on the command line. Community Commands
  • 33. Thank you! ! E-Mail: shawn@fivesense.ca Twitter: @shawnhooper ! www.shawnhooper.ca