Command Line WordPress with WP-CLI

J
James CollinsWordPress Web Developer at OM4
Command Line WordPress
with WP-CLI
James Collins
@om4james
http://jamesc.id.au/
WordPress Melbourne User Group - September 2013
What is WP-CLI?
A command line tool for managing WordPress
installations
Uses the command line (not a web browser)
http://wp-cli.org/
2
Why?
(Usually) faster than using a mouse
Powerful - automate/script common tasks
Useful when managing lots of WordPress
installations (including Multisite)
Active project with over 60 contributors
3
Usage
Install WP-CLI once on your computer/server
Navigate to a WordPress install:
cd /path/to/wordpress/install/
Run the ‘wp’ command:
wp
4
What Can It Do?
5
WordPress Core
Update WordPress core:
wp core update
Upgrade WordPress database:
wp core update-db
6
WordPress Plugins
Update all plugins:
wp plugin update-all
List all plugins:
wp plugin status
I = Inactive, A = Active, M = Must Use, U = Update Available
7
WordPress Plugins (cont.)
Install a plugin from WordPress.org:
wp plugin install facebook
Activate a plugin:
wp plugin activate facebook
or:
wp plugin install --activate facebook
8
WordPress Themes
Update all themes:
wp theme update-all
List all themes:
wp theme status
I = Inactive, A = Active, U = Update Available
9
WordPress Themes (cont.)
Install a theme from WordPress.org:
wp plugin install quark
Activate a theme:
wp theme activate quark
or:
wp theme install --activate quark
10
Update Everything!
Update WordPress, plugins & themes:
wp core update && wp plugin update-all &&
wp theme update-all
Use this in a daily cron job (if you dare)
11
Database Search/Replace
Search/replace in all tables in the database
Will correctly handle serialized values
Useful when changing domain names
wp search-replace 'http://example.dev'
'http://example.com' --dry-run
12
WordPress Media/Uploads
Regenerate/recreate WordPress thumbnails:
wp media regenerate
Useful after changing image size settings, or
switching themes
13
Create Posts
Create 100 posts:
wp post generate --count=100
14
Create Pages
Create 100 pages, 3 levels deep:
wp post generate --count=100
--post_type=page --max_depth=3
15
Create New Plugin
Create a new (empty) plugin and activate it:
wp scaffold plugin myplugin --
plugin_name='My Plugin' --activate
Useful when developing a new plugin
16
Download & Install WordPress
cd /path/to/empty/directory/
wp core download
wp core config --dbname=wpcli --
dbuser=wpcli --dbpass=wpcli
wp core install
17
Also:
Add/manage comments
Add/manage users
Database import/export
Change WordPress options
Heaps more!
18
Questions?
http://wp-cli.org/
https://github.com/wp-cli/wp-cli
These slides are online at:
http://jamesc.id.au/wp-cli/
19
1 of 19

Recommended

Command Line WordPress with WP-CLI - WordPress Perth User Group by
Command Line WordPress with WP-CLI - WordPress Perth User GroupCommand Line WordPress with WP-CLI - WordPress Perth User Group
Command Line WordPress with WP-CLI - WordPress Perth User GroupJames Collins
15K views13 slides
WP-CLI - WordCamp Miami 2015 by
WP-CLI - WordCamp Miami 2015WP-CLI - WordCamp Miami 2015
WP-CLI - WordCamp Miami 2015Shawn Hooper
1.7K views33 slides
Best Practices for creating WP REST API by Galkin Nikita by
Best Practices for creating WP REST API by Galkin NikitaBest Practices for creating WP REST API by Galkin Nikita
Best Practices for creating WP REST API by Galkin NikitaWordCamp Kyiv
318 views11 slides
WordPress and The Command Line by
WordPress and The Command LineWordPress and The Command Line
WordPress and The Command LineKelly Dwan
3.9K views34 slides
Installing WP-CLI locally by
Installing WP-CLI locallyInstalling WP-CLI locally
Installing WP-CLI locallyJason Yingling
104 views11 slides
WP-CLI Talk from WordCamp Montreal by
WP-CLI Talk from WordCamp MontrealWP-CLI Talk from WordCamp Montreal
WP-CLI Talk from WordCamp MontrealShawn Hooper
954 views33 slides

More Related Content

What's hot

Manage WordPress From the Command Line with WP-CLI by
Manage WordPress From the Command Line with WP-CLIManage WordPress From the Command Line with WP-CLI
Manage WordPress From the Command Line with WP-CLIShawn Hooper
1.2K views36 slides
WP-CLI Presentation from WordCamp NYC 2015 by
WP-CLI Presentation from WordCamp NYC 2015WP-CLI Presentation from WordCamp NYC 2015
WP-CLI Presentation from WordCamp NYC 2015Shawn Hooper
1K views36 slides
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car... by
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Andrea Cardinali
3.1K views82 slides
Why it's dangerous to turn off automatic updates and here's how to do it by
Why it's dangerous to turn off automatic updates and here's how to do itWhy it's dangerous to turn off automatic updates and here's how to do it
Why it's dangerous to turn off automatic updates and here's how to do itOnni Hakala
1.2K views27 slides
How I Learned to Stop Worrying and Backup WordPress by
How I Learned to Stop Worrying and Backup WordPressHow I Learned to Stop Worrying and Backup WordPress
How I Learned to Stop Worrying and Backup WordPressChris Jean
1.8K views22 slides
Set up dev environment by
Set up dev environmentSet up dev environment
Set up dev environmentICourses Ottawa
1.6K views34 slides

What's hot(20)

Manage WordPress From the Command Line with WP-CLI by Shawn Hooper
Manage WordPress From the Command Line with WP-CLIManage WordPress From the Command Line with WP-CLI
Manage WordPress From the Command Line with WP-CLI
Shawn Hooper1.2K views
WP-CLI Presentation from WordCamp NYC 2015 by Shawn Hooper
WP-CLI Presentation from WordCamp NYC 2015WP-CLI Presentation from WordCamp NYC 2015
WP-CLI Presentation from WordCamp NYC 2015
Shawn Hooper1K views
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car... by Andrea Cardinali
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Andrea Cardinali3.1K views
Why it's dangerous to turn off automatic updates and here's how to do it by Onni Hakala
Why it's dangerous to turn off automatic updates and here's how to do itWhy it's dangerous to turn off automatic updates and here's how to do it
Why it's dangerous to turn off automatic updates and here's how to do it
Onni Hakala1.2K views
How I Learned to Stop Worrying and Backup WordPress by Chris Jean
How I Learned to Stop Worrying and Backup WordPressHow I Learned to Stop Worrying and Backup WordPress
How I Learned to Stop Worrying and Backup WordPress
Chris Jean1.8K views
Optimizing WordPress (WordCamp Philly 2011) by Ben Metcalfe
Optimizing WordPress (WordCamp Philly 2011)Optimizing WordPress (WordCamp Philly 2011)
Optimizing WordPress (WordCamp Philly 2011)
Ben Metcalfe2.1K views
WordPress Migrations 101 - WordCamp Orlando by SiteGround.com
WordPress Migrations 101 - WordCamp OrlandoWordPress Migrations 101 - WordCamp Orlando
WordPress Migrations 101 - WordCamp Orlando
SiteGround.com1.3K views
Optimizing WordPress - WordPress SF Meetup April 2012 by Ben Metcalfe
Optimizing WordPress -  WordPress SF Meetup April 2012Optimizing WordPress -  WordPress SF Meetup April 2012
Optimizing WordPress - WordPress SF Meetup April 2012
Ben Metcalfe3.1K views
Drupal VM for Drupal 8 Dev - MidCamp 2017 by Jeff Geerling
Drupal VM for Drupal 8 Dev - MidCamp 2017Drupal VM for Drupal 8 Dev - MidCamp 2017
Drupal VM for Drupal 8 Dev - MidCamp 2017
Jeff Geerling2K views
Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017 by Jeff Geerling
Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017
Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017
Jeff Geerling539 views
WordPress Performance optimization by Brecht Ryckaert
WordPress Performance optimizationWordPress Performance optimization
WordPress Performance optimization
Brecht Ryckaert1.2K views
I Can Haz More Performanz? by Andy Melichar
I Can Haz More Performanz?I Can Haz More Performanz?
I Can Haz More Performanz?
Andy Melichar2.2K views
Developing Plugins For WordPress by Lester Chan
Developing Plugins For WordPressDeveloping Plugins For WordPress
Developing Plugins For WordPress
Lester Chan1.3K views
WordPress Security & Backup by Randy Barnes
WordPress Security & Backup WordPress Security & Backup
WordPress Security & Backup
Randy Barnes3.7K views
The Power of a Video Library - WordCamp Raleigh by Lauren Jeffcoat
The  Power of a Video Library - WordCamp RaleighThe  Power of a Video Library - WordCamp Raleigh
The Power of a Video Library - WordCamp Raleigh
Lauren Jeffcoat839 views
Coding with jetpack by Rich Collier
Coding with jetpackCoding with jetpack
Coding with jetpack
Rich Collier1.7K views
WordCamp SF 2011: Debugging in WordPress by andrewnacin
WordCamp SF 2011: Debugging in WordPressWordCamp SF 2011: Debugging in WordPress
WordCamp SF 2011: Debugging in WordPress
andrewnacin3.9K views
Installation xampp and WordPress on localhost by Luzan Baral
Installation xampp and WordPress on localhostInstallation xampp and WordPress on localhost
Installation xampp and WordPress on localhost
Luzan Baral4.4K views

Similar to Command Line WordPress with WP-CLI

Administer WordPress with WP-CLI by
Administer WordPress with WP-CLIAdminister WordPress with WP-CLI
Administer WordPress with WP-CLISuwash Kunwar
682 views53 slides
Take Command of WordPress With WP-CLI by
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLIDiana Thompson
424 views72 slides
Take Command of WordPress With WP-CLI by
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLIDiana Thompson
339 views94 slides
Take Command of WordPress With WP-CLI at WordCamp Long Beach by
Take Command of WordPress With WP-CLI at WordCamp Long BeachTake Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long BeachDiana Thompson
212 views79 slides
Introduction to WP-CLI: Manage WordPress from the command line by
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineBehzod Saidov
102 views30 slides
Take Command of WordPress With WP-CLI by
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLIDiana Thompson
148 views60 slides

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

Administer WordPress with WP-CLI by Suwash Kunwar
Administer WordPress with WP-CLIAdminister WordPress with WP-CLI
Administer WordPress with WP-CLI
Suwash Kunwar682 views
Take Command of WordPress With WP-CLI by Diana Thompson
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
Diana Thompson424 views
Take Command of WordPress With WP-CLI by Diana Thompson
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
Diana Thompson339 views
Take Command of WordPress With WP-CLI at WordCamp Long Beach by Diana Thompson
Take Command of WordPress With WP-CLI at WordCamp Long BeachTake Command of WordPress With WP-CLI at WordCamp Long Beach
Take Command of WordPress With WP-CLI at WordCamp Long Beach
Diana Thompson212 views
Introduction to WP-CLI: Manage WordPress from the command line by Behzod Saidov
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command line
Behzod Saidov102 views
Take Command of WordPress With WP-CLI by Diana Thompson
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
Diana Thompson148 views
Developers, Be a Bada$$ with WP-CLI by WP Engine
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
WP Engine1.1K views
Creating Your First WordPress Plugin by Brad Williams
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
Brad Williams4.8K views
WP-CLI: WordCamp Nashville 2016 by Terell Moore
WP-CLI: WordCamp Nashville 2016WP-CLI: WordCamp Nashville 2016
WP-CLI: WordCamp Nashville 2016
Terell Moore917 views
Getting Started with WP-CLI, a tool to automate your life by AJ Morris
Getting Started with WP-CLI, a tool to automate your lifeGetting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your life
AJ Morris256 views
Intro to WordPress Plugin Development by Brad Williams
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
Brad Williams7.5K views
Extending Your WordPress Toolbelt with WP-CLI by ryanduff
Extending Your WordPress Toolbelt with WP-CLIExtending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLI
ryanduff1.1K views
Cms drupal installation & configuration anil mishra by Anil Mishra
Cms drupal installation & configuration   anil mishraCms drupal installation & configuration   anil mishra
Cms drupal installation & configuration anil mishra
Anil Mishra716 views
WordPress Security - 12 WordPress Security Fundamentals by findingsimple
WordPress Security - 12 WordPress Security FundamentalsWordPress Security - 12 WordPress Security Fundamentals
WordPress Security - 12 WordPress Security Fundamentals
findingsimple8.8K views

Recently uploaded

Info Session November 2023.pdf by
Info Session November 2023.pdfInfo Session November 2023.pdf
Info Session November 2023.pdfAleksandraKoprivica4
10 views15 slides
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensorssugiuralab
15 views15 slides
Special_edition_innovator_2023.pdf by
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdfWillDavies22
16 views6 slides
Vertical User Stories by
Vertical User StoriesVertical User Stories
Vertical User StoriesMoisés Armani Ramírez
11 views16 slides
Data-centric AI and the convergence of data and model engineering: opportunit... by
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...Paolo Missier
34 views40 slides
Melek BEN MAHMOUD.pdf by
Melek BEN MAHMOUD.pdfMelek BEN MAHMOUD.pdf
Melek BEN MAHMOUD.pdfMelekBenMahmoud
14 views1 slide

Recently uploaded(20)

TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab15 views
Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2216 views
Data-centric AI and the convergence of data and model engineering: opportunit... by Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier34 views
Lilypad @ Labweek, Istanbul, 2023.pdf by Ally339821
Lilypad @ Labweek, Istanbul, 2023.pdfLilypad @ Labweek, Istanbul, 2023.pdf
Lilypad @ Labweek, Istanbul, 2023.pdf
Ally3398219 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana12 views
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson33 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Perth MeetUp November 2023 by Michael Price
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023
Michael Price15 views
Unit 1_Lecture 2_Physical Design of IoT.pdf by StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec11 views
1st parposal presentation.pptx by i238212
1st parposal presentation.pptx1st parposal presentation.pptx
1st parposal presentation.pptx
i2382129 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma17 views
From chaos to control: Managing migrations and Microsoft 365 with ShareGate! by sammart93
From chaos to control: Managing migrations and Microsoft 365 with ShareGate!From chaos to control: Managing migrations and Microsoft 365 with ShareGate!
From chaos to control: Managing migrations and Microsoft 365 with ShareGate!
sammart939 views
Black and White Modern Science Presentation.pptx by maryamkhalid2916
Black and White Modern Science Presentation.pptxBlack and White Modern Science Presentation.pptx
Black and White Modern Science Presentation.pptx
maryamkhalid291614 views

Command Line WordPress with WP-CLI