SlideShare a Scribd company logo
Getting Started with WP-CLI, a
tool to automate your life
@ajmorris
What is it?
WP-CLI is a set of command-line tools for managing
WordPress installations. You can update plugins, configure
multisite installs and much more, without using a web
browser.
Recently has been brought under the WordPress project.
Current Maintainer: Daniel Bachhuber
@ajmorris
Command-Line say What?!?
Don’t fear the
command-line!
@ajmorris
What type of tools can I use?
• Download, install, update and manage WordPress core
• Install, Activate, Deactivate WordPress themes and
plugins
• Manage WP-Cron events and schedules
• Manage Attachment
• Manage and backup Database
@ajmorris
What type of tools can I use?
• Perform basic database operations
• Publish posts
• User Management: Add, Remove, Update Roles
• Manage Comments
• And it’s extendable
@ajmorris
Requirements
• UNIX-like environment (OS X, Linux, FreeBSD, Cygwin)
• PHP 5.3.29 or later
• WordPress 3.7 or later
@ajmorris
Install WP-Cli
$ curl -O https://raw.githubusercontent.com/wp-cli/
builds/gh-pages/phar/wp-cli.phar
$ php wp-cli.phar -- info
$ chmod +x wp-cli.phar
$ sudo mv wp-cli.phar /usr/local/bin/wp
@ajmorris
Hosts WP-Cli Installed
@ajmorris
Local Development
Varying Vagrant Vagrants - http://ajmorris.us/WPVVV
Local by Flywheel - http://ajmorris.us/localflywheel
Docker - http://ajmorris.us/wdocker
DockerWP - http://ajmorris.us/DockerWP
WP Docker - http://ajmorris.us/wp-docker
@ajmorris
Install WordPress
$ wp core download
$ wp core install --url=world.com --title=Doman
--admin_user=somethinglong
--admin_password=strongpassword
--admin_email=hello@world.com
@ajmorris
Manage Themes
$ wp theme
$ wp theme search
$ wp theme list
$ wp theme activate <theme_name>
@ajmorris
Manage Themes
$ wp theme status <theme_name>
$ wp theme update
$ wp theme is-installed
$ wp theme path
@ajmorris
Manage Plugins
$ wp plugin list
$ wp plugin install <plugin-slug>
$ wp plugin activate <plugin-slug>
$ wp plugin update <plugin-slug>
@ajmorris
Manage Plugins
$ wp plugin list --update=available
$ wp plugin list --fields=name,version
@ajmorris
Manage Cron Tasks
$ wp cron event list
$ wp cron event schedule <hook> <next-run>
<recurrence>
$ wp cron event delete <hook>
@ajmorris
Media Import
$ wp media import <file>
$ wp media regenerate
@ajmorris
Manage Database
$ wp db cli
$ wp db optimize
$ wp db export <file_name>
$ wp db import <file_name>
@ajmorris
Manage Database
$ wp db tables
$ wp db reset --yes
$ wp search-replace “old-url” “new-url”
@ajmorris
Manage WordPress Options
$ wp option get db_version
$ wp option get current_theme
$ wp option get blogname
$ wp option get admin_email
@ajmorris
Manage Users
$ wp user list
$ wp user create newuser <email> --
role=administrator --user_pass=123aqe --
display_name=“AJ Morris”
$ wp user list --
fields=user_login,display_name,user_name,roles
@ajmorris
Manage Cache & Transients
$ wp cache flush
$ wp transient delete-expired
$ wp rewrite structure ‘%postname%’
$wp rewrite flush
@ajmorris
Manage Posts
$ wp post list --fields=ID,post_title,post_status
$ wp post create --post_type=post --post_title=‘A
WordCamp Jackson’ --post_status=draft
$ wp post edit <id>
@ajmorris
Demo Time
Let’s Jump into the Command Line!
@ajmorris
About Me
Product Marketing
Liquid Web
Twitter: @ajmorris
Blog: https://ajmorris.me
@ajmorris
Questions?
@ajmorris
Thank You!
@ajmorris

More Related Content

What's hot (20)

PPTX
WordPress Plugin development
Mostafa Soufi
 
PDF
Getting to The Loop - London Wordpress Meetup July 28th
Chris Adams
 
PPT
Dance for the puppet master: G6 Tech Talk
Michael Peacock
 
PPTX
Rebrand WordPress Admin
Chandra Prakash Thapa
 
PDF
Extending the WordPress REST API - Josh Pollock
Caldera Labs
 
PDF
WordCamp San Francisco 2011: Transients, Caching, and the Complexities of Mul...
andrewnacin
 
PDF
Caching in WordPress
Tareq Hasan
 
PPTX
Saving Time with WP-CLI
Taylor Lovett
 
KEY
國民雲端架構 Django + GAE
Winston Chen
 
PDF
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
Tareq Hasan
 
PDF
You Don't Know Query - WordCamp Portland 2011
andrewnacin
 
PPTX
Working with WP_Query in WordPress
topher1kenobe
 
PPTX
Introduction to WordPress Development - Hooks
Edmund Chan
 
PDF
The wp config.php
Anthony Montalbano
 
PDF
You Got React.js in My PHP
Taylor Lovett
 
KEY
Doing Things the WordPress Way
Matt Wiebe
 
PDF
Caldera Learn - LoopConf WP API + Angular FTW Workshop
CalderaLearn
 
PDF
OpenERP and Perl
OpusVL
 
PDF
Write your first WordPress plugin
Anthony Montalbano
 
PDF
Isomorphic WordPress Applications with NodeifyWP
Taylor Lovett
 
WordPress Plugin development
Mostafa Soufi
 
Getting to The Loop - London Wordpress Meetup July 28th
Chris Adams
 
Dance for the puppet master: G6 Tech Talk
Michael Peacock
 
Rebrand WordPress Admin
Chandra Prakash Thapa
 
Extending the WordPress REST API - Josh Pollock
Caldera Labs
 
WordCamp San Francisco 2011: Transients, Caching, and the Complexities of Mul...
andrewnacin
 
Caching in WordPress
Tareq Hasan
 
Saving Time with WP-CLI
Taylor Lovett
 
國民雲端架構 Django + GAE
Winston Chen
 
WordPress Theme & Plugin development best practices - phpXperts seminar 2011
Tareq Hasan
 
You Don't Know Query - WordCamp Portland 2011
andrewnacin
 
Working with WP_Query in WordPress
topher1kenobe
 
Introduction to WordPress Development - Hooks
Edmund Chan
 
The wp config.php
Anthony Montalbano
 
You Got React.js in My PHP
Taylor Lovett
 
Doing Things the WordPress Way
Matt Wiebe
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
CalderaLearn
 
OpenERP and Perl
OpusVL
 
Write your first WordPress plugin
Anthony Montalbano
 
Isomorphic WordPress Applications with NodeifyWP
Taylor Lovett
 

Similar to Getting Started with WP-CLI, a tool to automate your life (20)

PDF
Command Line WordPress with WP-CLI
James Collins
 
PDF
Introduction to WP-CLI: Manage WordPress from the command line
Behzod Saidov
 
PDF
WP-CLI - WordCamp Miami 2015
Shawn Hooper
 
PPTX
Aditya Shah - WPCLI - WordCamp Asia
Aditya Shah
 
PDF
WP-CLI Talk from WordCamp Montreal
Shawn Hooper
 
PPTX
Installing WP-CLI locally
Jason Yingling
 
PPTX
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Diana Thompson
 
PDF
WordPress and The Command Line
Kelly Dwan
 
PDF
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
ryanduff
 
PDF
Save Time by Managing WordPress from the Command Line
Shawn Hooper
 
PPTX
Take Command of WordPress With WP-CLI
Diana Thompson
 
PPTX
Take Command of WordPress With WP-CLI
Diana Thompson
 
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
 
PDF
Workshop On WP-CLI
Ajit Bohra
 
PDF
The Themer's Guide to WP-CLI
Edmund Turbin
 
PDF
The Themer's Guide to WP-CLI
Edmund Turbin
 
PDF
Command Line WordPress with WP-CLI - WordPress Perth User Group
James Collins
 
ODP
Administer WordPress with WP-CLI
Suwash Kunwar
 
PDF
Remote Control WordPress
Edmund Turbin
 
Command Line WordPress with WP-CLI
James Collins
 
Introduction to WP-CLI: Manage WordPress from the command line
Behzod Saidov
 
WP-CLI - WordCamp Miami 2015
Shawn Hooper
 
Aditya Shah - WPCLI - WordCamp Asia
Aditya Shah
 
WP-CLI Talk from WordCamp Montreal
Shawn Hooper
 
Installing WP-CLI locally
Jason Yingling
 
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Diana Thompson
 
WordPress and The Command Line
Kelly Dwan
 
Extending your WordPress Toolbelt with WP-CLI - WordCamp Austin 2014
ryanduff
 
Save Time by Managing WordPress from the Command Line
Shawn Hooper
 
Take Command of WordPress With WP-CLI
Diana Thompson
 
Take Command of WordPress With WP-CLI
Diana Thompson
 
Take Command of WordPress With WP-CLI
Diana Thompson
 
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Andrea Cardinali
 
Workshop On WP-CLI
Ajit Bohra
 
The Themer's Guide to WP-CLI
Edmund Turbin
 
The Themer's Guide to WP-CLI
Edmund Turbin
 
Command Line WordPress with WP-CLI - WordPress Perth User Group
James Collins
 
Administer WordPress with WP-CLI
Suwash Kunwar
 
Remote Control WordPress
Edmund Turbin
 
Ad

More from AJ Morris (8)

PDF
What The West Wing Can Teach Us About Building Products
AJ Morris
 
PDF
Wordcamp Sacramento 2017 Presentation - How to build your email list
AJ Morris
 
PDF
How to Start an Online Business
AJ Morris
 
PDF
How to build an email list and generate qualified leads using WordPress
AJ Morris
 
PDF
How to Build Products
AJ Morris
 
PDF
WordCamp 2013 Building Awesome with WordPress
AJ Morris
 
KEY
Deploying WordPress with Hubot
AJ Morris
 
KEY
All About WordPress
AJ Morris
 
What The West Wing Can Teach Us About Building Products
AJ Morris
 
Wordcamp Sacramento 2017 Presentation - How to build your email list
AJ Morris
 
How to Start an Online Business
AJ Morris
 
How to build an email list and generate qualified leads using WordPress
AJ Morris
 
How to Build Products
AJ Morris
 
WordCamp 2013 Building Awesome with WordPress
AJ Morris
 
Deploying WordPress with Hubot
AJ Morris
 
All About WordPress
AJ Morris
 
Ad

Recently uploaded (20)

PDF
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PDF
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
PDF
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PPTX
Water Resources Engineering (CVE 728)--Slide 4.pptx
mohammedado3
 
PDF
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PPT
Testing and final inspection of a solar PV system
MuhammadSanni2
 
PPT
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
PDF
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PPTX
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
PPTX
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PDF
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
Electrical Machines and Their Protection.pdf
Nabajyoti Banik
 
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Water Resources Engineering (CVE 728)--Slide 4.pptx
mohammedado3
 
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
Testing and final inspection of a solar PV system
MuhammadSanni2
 
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
aAn_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
What is Shot Peening | Shot Peening is a Surface Treatment Process
Vibra Finish
 
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 

Getting Started with WP-CLI, a tool to automate your life

  • 1. Getting Started with WP-CLI, a tool to automate your life @ajmorris
  • 2. What is it? WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser. Recently has been brought under the WordPress project. Current Maintainer: Daniel Bachhuber @ajmorris
  • 3. Command-Line say What?!? Don’t fear the command-line! @ajmorris
  • 4. What type of tools can I use? • Download, install, update and manage WordPress core • Install, Activate, Deactivate WordPress themes and plugins • Manage WP-Cron events and schedules • Manage Attachment • Manage and backup Database @ajmorris
  • 5. What type of tools can I use? • Perform basic database operations • Publish posts • User Management: Add, Remove, Update Roles • Manage Comments • And it’s extendable @ajmorris
  • 6. Requirements • UNIX-like environment (OS X, Linux, FreeBSD, Cygwin) • PHP 5.3.29 or later • WordPress 3.7 or later @ajmorris
  • 7. Install WP-Cli $ curl -O https://raw.githubusercontent.com/wp-cli/ builds/gh-pages/phar/wp-cli.phar $ php wp-cli.phar -- info $ chmod +x wp-cli.phar $ sudo mv wp-cli.phar /usr/local/bin/wp @ajmorris
  • 9. Local Development Varying Vagrant Vagrants - http://ajmorris.us/WPVVV Local by Flywheel - http://ajmorris.us/localflywheel Docker - http://ajmorris.us/wdocker DockerWP - http://ajmorris.us/DockerWP WP Docker - http://ajmorris.us/wp-docker @ajmorris
  • 10. Install WordPress $ wp core download $ wp core install --url=world.com --title=Doman --admin_user=somethinglong --admin_password=strongpassword [email protected] @ajmorris
  • 11. Manage Themes $ wp theme $ wp theme search $ wp theme list $ wp theme activate <theme_name> @ajmorris
  • 12. Manage Themes $ wp theme status <theme_name> $ wp theme update $ wp theme is-installed $ wp theme path @ajmorris
  • 13. Manage Plugins $ wp plugin list $ wp plugin install <plugin-slug> $ wp plugin activate <plugin-slug> $ wp plugin update <plugin-slug> @ajmorris
  • 14. Manage Plugins $ wp plugin list --update=available $ wp plugin list --fields=name,version @ajmorris
  • 15. Manage Cron Tasks $ wp cron event list $ wp cron event schedule <hook> <next-run> <recurrence> $ wp cron event delete <hook> @ajmorris
  • 16. Media Import $ wp media import <file> $ wp media regenerate @ajmorris
  • 17. Manage Database $ wp db cli $ wp db optimize $ wp db export <file_name> $ wp db import <file_name> @ajmorris
  • 18. Manage Database $ wp db tables $ wp db reset --yes $ wp search-replace “old-url” “new-url” @ajmorris
  • 19. Manage WordPress Options $ wp option get db_version $ wp option get current_theme $ wp option get blogname $ wp option get admin_email @ajmorris
  • 20. Manage Users $ wp user list $ wp user create newuser <email> -- role=administrator --user_pass=123aqe -- display_name=“AJ Morris” $ wp user list -- fields=user_login,display_name,user_name,roles @ajmorris
  • 21. Manage Cache & Transients $ wp cache flush $ wp transient delete-expired $ wp rewrite structure ‘%postname%’ $wp rewrite flush @ajmorris
  • 22. Manage Posts $ wp post list --fields=ID,post_title,post_status $ wp post create --post_type=post --post_title=‘A WordCamp Jackson’ --post_status=draft $ wp post edit <id> @ajmorris
  • 23. Demo Time Let’s Jump into the Command Line! @ajmorris
  • 24. About Me Product Marketing Liquid Web Twitter: @ajmorris Blog: https://ajmorris.me @ajmorris