SlideShare a Scribd company logo
1 of 34
Download to read offline
WordPress & 
the command line 
Kelly Dwan 
@ryelle 
NERD Summit • Sept 2014
About Me 
WordPress Developer 
Core Contributor 
Boston WordPress Organizer
“Why should I use the command line, when 
WordPress already has such a fantastic UI?”
• Already included in VVV, VIP Quickstart 
https://github.com/Varying-Vagrant-Vagrants/VVV/ 
https://github.com/Automattic/vip-quickstart 
• Most major hosts include it: DreamHost, Media 
Temple, BlueHost, SiteGround, 1&1… 
• Installation: 
http://wp-cli.org/#install
Basic Commands
wp command subcommand <argument> —flag
• wp core version 
• wp core update 
• wp plugin list 
• wp plugin install <name> [--activate] 
• wp theme list 
• wp theme activate <name>
• wp core download 
• wp core config 
• wp core install / multisite-install 
• wp core multisite-convert
wp help 
wp help <command> 
wp help <command> <subcommand>
Content 
Management
• wp post create 
• wp post delete 
• wp post url 
• wp post meta list 
• wp post meta update
• wp comment approve 
• wp comment delete $(wp comment list -- 
status=spam --format=ids)
• wp media import
• wp term create 
• wp term generate 
• wp term list
Tools
• wp export [—skip_comments] 
• wp import 
• wp media regenerate
Advanced 
Management
• wp user create 
• wp user import-csv 
• wp user remove-cap 
• wp role list 
• wp cap list
• wp cron test 
• wp cron schedule list 
• wp cron event list 
• wp cron event run
• wp rewrite list 
• wp rewrite flush 
• wp rewrite structure
Custom 
Commands
“Adding commands to your plugin is great for 
encouraging good API design, collaborating 
amidst a changing data structure, efficiency, and 
better debugging.” 
–Matt Wiebe, Why You Should Develop Plugins With wp-cli
• Jetpack module control 
• wp jetpack module list 
• wp jetpack module activate 
• BackUpWordPress 
• wp backup [lots of options]
how to write your own
if ( defined('WP_CLI') && WP_CLI ) { 
include __DIR__ . '/my-command.php'; 
}
class Example_Command extends WP_CLI_Command { 
/** 
* Prints a greeting. 
* @synopsis <name> 
*/ 
function hello( $args, $assoc_args ) { 
list( $name ) = $args; 
! 
// Print a success message 
WP_CLI::success( "Hello, $name!" ); 
} 
} 
! 
WP_CLI::add_command( 'example', 'Example_Command' );
class Example_Command extends WP_CLI_Command { 
/** 
* Prints a greeting. 
* @synopsis <name> [<last-name>] 
*/ 
function hello( $args, $assoc_args ) { 
list( $name ) = $args; 
! 
// Print a success message 
WP_CLI::success( "Hello, $name!" ); 
} 
} 
! 
WP_CLI::add_command( 'example', 'Example_Command' );
• WP CLI Commands Cookbook walks through this 
in more detail.
Automated 
Migrations
From WordPress
• wp export [on source site] 
• wp import [on destination] 
• wp search-replace <old> <new> 
—skip-columns=guid —dry-run
From Other CMSs
• Importing (any!) Content with WP-CLI
• https://github.com/wp-cli/wp-cli/wiki/External- 
Resources 
• http://redradar.net/nerds-wp-cli

More Related Content

What's hot

Advanced WordPress Development Environments
Advanced WordPress Development EnvironmentsAdvanced WordPress Development Environments
Advanced WordPress Development Environments
Beau Lebens
 

What's hot (20)

Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescue
 
Internationalizing The New York Times
Internationalizing The New York TimesInternationalizing The New York Times
Internationalizing The New York Times
 
Best Practices for creating WP REST API by Galkin Nikita
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 Nikita
 
Developing Plugins For WordPress
Developing Plugins For WordPressDeveloping Plugins For WordPress
Developing Plugins For WordPress
 
The Next Step in Responsive - RESS
The Next Step in Responsive - RESSThe Next Step in Responsive - RESS
The Next Step in Responsive - RESS
 
Creating Local WordPress Installs
Creating Local WordPress InstallsCreating Local WordPress Installs
Creating Local WordPress Installs
 
WordPress as the Backbone(.js)
WordPress as the Backbone(.js)WordPress as the Backbone(.js)
WordPress as the Backbone(.js)
 
Isomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWPIsomorphic WordPress Applications with NodeifyWP
Isomorphic WordPress Applications with NodeifyWP
 
Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015Speeding up your WordPress Site - WordCamp Toronto 2015
Speeding up your WordPress Site - WordCamp Toronto 2015
 
Building an API in Node with HapiJS
Building an API in Node with HapiJSBuilding an API in Node with HapiJS
Building an API in Node with HapiJS
 
An Introduction to hapi.js
An Introduction to hapi.jsAn Introduction to hapi.js
An Introduction to hapi.js
 
Using hapi plugins to version your API (hapiDays 2014)
Using hapi plugins to version your API (hapiDays 2014)Using hapi plugins to version your API (hapiDays 2014)
Using hapi plugins to version your API (hapiDays 2014)
 
Advanced WordPress Development Environments
Advanced WordPress Development EnvironmentsAdvanced WordPress Development Environments
Advanced WordPress Development Environments
 
Piecing Together the WordPress Puzzle
Piecing Together the WordPress PuzzlePiecing Together the WordPress Puzzle
Piecing Together the WordPress Puzzle
 
Best Practices for WordPress in Enterprise
Best Practices for WordPress in EnterpriseBest Practices for WordPress in Enterprise
Best Practices for WordPress in Enterprise
 
Week1 Introduction
Week1 IntroductionWeek1 Introduction
Week1 Introduction
 
Introdcution to Adobe CQ
Introdcution to Adobe CQIntrodcution to Adobe CQ
Introdcution to Adobe CQ
 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
 
Best Practices for WordPress
Best Practices for WordPressBest Practices for WordPress
Best Practices for WordPress
 
Angular2 ecosystem
Angular2 ecosystemAngular2 ecosystem
Angular2 ecosystem
 

Similar to WordPress and The Command Line

Worcamp2012 make a wordpress multisite in 20mins
Worcamp2012 make a wordpress multisite in 20minsWorcamp2012 make a wordpress multisite in 20mins
Worcamp2012 make a wordpress multisite in 20mins
Chandra Prakash Thapa
 
Chandra Prakash Thapa: Make a WordPress Multisite in 20 mins
Chandra Prakash Thapa: Make a WordPress Multisite in 20 minsChandra Prakash Thapa: Make a WordPress Multisite in 20 mins
Chandra Prakash Thapa: Make a WordPress Multisite in 20 mins
wpnepal
 
Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013
Think Media Inc.
 

Similar to WordPress and The Command Line (20)

Saving Time with WP-CLI
Saving Time with WP-CLISaving Time with WP-CLI
Saving Time with WP-CLI
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
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...
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
 
Worcamp2012 make a wordpress multisite in 20mins
Worcamp2012 make a wordpress multisite in 20minsWorcamp2012 make a wordpress multisite in 20mins
Worcamp2012 make a wordpress multisite in 20mins
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
 
Chandra Prakash Thapa: Make a WordPress Multisite in 20 mins
Chandra Prakash Thapa: Make a WordPress Multisite in 20 minsChandra Prakash Thapa: Make a WordPress Multisite in 20 mins
Chandra Prakash Thapa: Make a WordPress Multisite in 20 mins
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
The WP Engine Developer Experience. Increased agility, improved efficiency.
The WP Engine Developer Experience. Increased agility, improved efficiency.The WP Engine Developer Experience. Increased agility, improved efficiency.
The WP Engine Developer Experience. Increased agility, improved efficiency.
 
Take Command of WordPress With WP-CLI at WordCamp Long Beach
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
 
WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!WordPress Acceptance Testing, Solved!
WordPress Acceptance Testing, Solved!
 
WordPress CLI in-depth
WordPress CLI in-depthWordPress CLI in-depth
WordPress CLI in-depth
 
Administer WordPress with WP-CLI
Administer WordPress with WP-CLIAdminister WordPress with WP-CLI
Administer WordPress with WP-CLI
 
Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013Presentation to SAIT Students - Dec 2013
Presentation to SAIT Students - Dec 2013
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
Developers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLIDevelopers, Be a Bada$$ with WP-CLI
Developers, Be a Bada$$ with WP-CLI
 
Intro to WordPress Plugin Development
Intro to WordPress Plugin DevelopmentIntro to WordPress Plugin Development
Intro to WordPress Plugin Development
 
The WordPress Way
The WordPress WayThe WordPress Way
The WordPress Way
 
Word Press As A Cms
Word Press As A CmsWord Press As A Cms
Word Press As A Cms
 
Advanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comAdvanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.com
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

WordPress and The Command Line

  • 1. WordPress & the command line Kelly Dwan @ryelle NERD Summit • Sept 2014
  • 2. About Me WordPress Developer Core Contributor Boston WordPress Organizer
  • 3. “Why should I use the command line, when WordPress already has such a fantastic UI?”
  • 4. • Already included in VVV, VIP Quickstart https://github.com/Varying-Vagrant-Vagrants/VVV/ https://github.com/Automattic/vip-quickstart • Most major hosts include it: DreamHost, Media Temple, BlueHost, SiteGround, 1&1… • Installation: http://wp-cli.org/#install
  • 6. wp command subcommand <argument> —flag
  • 7. • wp core version • wp core update • wp plugin list • wp plugin install <name> [--activate] • wp theme list • wp theme activate <name>
  • 8. • wp core download • wp core config • wp core install / multisite-install • wp core multisite-convert
  • 9. wp help wp help <command> wp help <command> <subcommand>
  • 11. • wp post create • wp post delete • wp post url • wp post meta list • wp post meta update
  • 12. • wp comment approve • wp comment delete $(wp comment list -- status=spam --format=ids)
  • 13. • wp media import
  • 14. • wp term create • wp term generate • wp term list
  • 15. Tools
  • 16. • wp export [—skip_comments] • wp import • wp media regenerate
  • 18. • wp user create • wp user import-csv • wp user remove-cap • wp role list • wp cap list
  • 19. • wp cron test • wp cron schedule list • wp cron event list • wp cron event run
  • 20. • wp rewrite list • wp rewrite flush • wp rewrite structure
  • 22. “Adding commands to your plugin is great for encouraging good API design, collaborating amidst a changing data structure, efficiency, and better debugging.” –Matt Wiebe, Why You Should Develop Plugins With wp-cli
  • 23. • Jetpack module control • wp jetpack module list • wp jetpack module activate • BackUpWordPress • wp backup [lots of options]
  • 24. how to write your own
  • 25. if ( defined('WP_CLI') && WP_CLI ) { include __DIR__ . '/my-command.php'; }
  • 26. class Example_Command extends WP_CLI_Command { /** * Prints a greeting. * @synopsis <name> */ function hello( $args, $assoc_args ) { list( $name ) = $args; ! // Print a success message WP_CLI::success( "Hello, $name!" ); } } ! WP_CLI::add_command( 'example', 'Example_Command' );
  • 27. class Example_Command extends WP_CLI_Command { /** * Prints a greeting. * @synopsis <name> [<last-name>] */ function hello( $args, $assoc_args ) { list( $name ) = $args; ! // Print a success message WP_CLI::success( "Hello, $name!" ); } } ! WP_CLI::add_command( 'example', 'Example_Command' );
  • 28. • WP CLI Commands Cookbook walks through this in more detail.
  • 31. • wp export [on source site] • wp import [on destination] • wp search-replace <old> <new> —skip-columns=guid —dry-run
  • 33. • Importing (any!) Content with WP-CLI