SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
Command Line WordPress 
with WP-CLI 
! 
James Collins 
! 
@om4james 
http://jamesc.id.au/ 
! 
! 
WordPress Perth User Group - October 2014
What is WP-CLI? 
A tool for managing WordPress installations 
Uses the command line (not a web browser) 
2
Why? 
(Usually) faster than using a mouse 
Powerful - automate/script common tasks 
Saves time when managing lots of WordPress 
installations (including Multisite) 
Active open source project with 90+ 
contributors 
3
Usage 
Install WP-CLI once on your computer/server 
http://wp-cli.org/ 
Navigate to a WordPress install: 
cd /path/to/wordpress/install/ 
Run the ‘wp’ command: 
wp 
4
What Can It Do? 
5
My Favourite Uses 
for WP-CLI 
6
Staying up-to-date 
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) 
7
Database Search/Replace 
Search/replace in all tables in the database 
Useful when changing domain names 
wp search-replace 'http://example.dev' 
'http://example.com' —dry-run 
(Will correctly handle serialized values) 
8
WordPress Media/Uploads 
Regenerate/recreate WordPress thumbnails: 
wp media regenerate 
Useful after changing image size settings, or 
switching themes 
9
Bulk User Management 
Bulk Import 1000+ Users 
The CSV file / spreadsheet: 
! 
! 
wp user import-csv --skip-update users.csv 
Full Details: http://jamesc.id.au/?p=1157 
10
Bulk User Management 
Bulk Delete all subscriber users: 
wp user list --role=subscriber --field=ID | 
xargs wp user delete --yes 
Full Details: http://jamesc.id.au/?p=1157 
11
Also: 
Install WordPress 
Database import/export 
Change WordPress options 
Heaps more! 
12
Questions? 
http://wp-cli.org/ 
https://github.com/wp-cli/wp-cli 
These slides are online at: 
http://jamesc.id.au/wp-cli-perth/ 
13

Mais conteúdo relacionado

Mais procurados

Optimizing WordPress - WordPress SF Meetup April 2012
Optimizing WordPress -  WordPress SF Meetup April 2012Optimizing WordPress -  WordPress SF Meetup April 2012
Optimizing WordPress - WordPress SF Meetup April 2012
Ben Metcalfe
 

Mais procurados (20)

Manage WordPress From the Command Line with WP-CLI
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
 
WP-CLI Presentation from WordCamp NYC 2015
WP-CLI Presentation from WordCamp NYC 2015WP-CLI Presentation from WordCamp NYC 2015
WP-CLI Presentation from WordCamp NYC 2015
 
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...
 
Optimizing WordPress (WordCamp Philly 2011)
Optimizing WordPress (WordCamp Philly 2011)Optimizing WordPress (WordCamp Philly 2011)
Optimizing WordPress (WordCamp Philly 2011)
 
How I Learned to Stop Worrying and Backup WordPress
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
 
Why 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 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
 
Set up dev environment
Set up dev environmentSet up dev environment
Set up dev environment
 
WordPress Migrations 101 - WordCamp Orlando
WordPress Migrations 101 - WordCamp OrlandoWordPress Migrations 101 - WordCamp Orlando
WordPress Migrations 101 - WordCamp Orlando
 
Optimizing WordPress - WordPress SF Meetup April 2012
Optimizing WordPress -  WordPress SF Meetup April 2012Optimizing WordPress -  WordPress SF Meetup April 2012
Optimizing WordPress - WordPress SF Meetup April 2012
 
Install Word Press with xampp
Install Word Press with xamppInstall Word Press with xampp
Install Word Press with xampp
 
WordPress Performance optimization
WordPress Performance optimizationWordPress Performance optimization
WordPress Performance optimization
 
I Can Haz More Performanz?
I Can Haz More Performanz?I Can Haz More Performanz?
I Can Haz More Performanz?
 
Drupal VM for Drupal 8 Dev - MidCamp 2017
Drupal VM for Drupal 8 Dev - MidCamp 2017Drupal VM for Drupal 8 Dev - MidCamp 2017
Drupal VM for Drupal 8 Dev - MidCamp 2017
 
Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017
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
 
Developing Plugins For WordPress
Developing Plugins For WordPressDeveloping Plugins For WordPress
Developing Plugins For WordPress
 
WordPress Security & Backup
WordPress Security & Backup WordPress Security & Backup
WordPress Security & Backup
 
The Power of a Video Library - WordCamp Raleigh
The  Power of a Video Library - WordCamp RaleighThe  Power of a Video Library - WordCamp Raleigh
The Power of a Video Library - WordCamp Raleigh
 
Coding with jetpack
Coding with jetpackCoding with jetpack
Coding with jetpack
 
Wp cli
Wp cliWp cli
Wp cli
 
Wp cli-wcbalt
Wp cli-wcbaltWp cli-wcbalt
Wp cli-wcbalt
 

Semelhante a Command Line WordPress with WP-CLI - WordPress Perth User Group

Semelhante a Command Line WordPress with WP-CLI - WordPress Perth User Group (20)

WP-CLI: WordCamp Nashville 2016
WP-CLI: WordCamp Nashville 2016WP-CLI: WordCamp Nashville 2016
WP-CLI: WordCamp Nashville 2016
 
Make your life easy with WP-CLI
Make your life easy with WP-CLIMake your life easy with WP-CLI
Make your life easy with WP-CLI
 
Drush for drupal website builder
Drush for drupal website builderDrush for drupal website builder
Drush for drupal website builder
 
Extending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLIExtending Your WordPress Toolbelt with WP-CLI
Extending Your WordPress Toolbelt with WP-CLI
 
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
Site Speed = Success – Optimising WordPress from the Server Up - Presented by...
 
WordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = SuccessWordCamp Harare 2016 - Site Speed = Success
WordCamp Harare 2016 - Site Speed = Success
 
Advanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.comAdvanced WordPress Tooling: By InstaWP.com
Advanced WordPress Tooling: By InstaWP.com
 
The Themer's Guide to WP-CLI
The Themer's Guide to WP-CLIThe Themer's Guide to WP-CLI
The Themer's Guide to WP-CLI
 
Save Time by Managing WordPress from the Command Line
Save Time by Managing WordPress from the Command LineSave Time by Managing WordPress from the Command Line
Save Time by Managing WordPress from the Command Line
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Introduction to WP-CLI: Manage WordPress from the command line
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
 
Hands on workshop on word press
Hands on workshop on word pressHands on workshop on word press
Hands on workshop on word press
 
Wordpress Beyond A Blog Word Camp Toronto08
Wordpress Beyond A Blog Word Camp Toronto08Wordpress Beyond A Blog Word Camp Toronto08
Wordpress Beyond A Blog Word Camp Toronto08
 
Drupal Multi-Site Setup
Drupal Multi-Site SetupDrupal Multi-Site Setup
Drupal Multi-Site Setup
 
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
Introducing WordPress Multitenancy (Wordcamp Vegas/Orlando 2015/WPCampus)
 
Introducing Wordpress Multitenancy
Introducing Wordpress MultitenancyIntroducing Wordpress Multitenancy
Introducing Wordpress Multitenancy
 
Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014
 
Administer WordPress with WP-CLI
Administer WordPress with WP-CLIAdminister WordPress with WP-CLI
Administer WordPress with WP-CLI
 
Remote Control WordPress
Remote Control WordPressRemote Control WordPress
Remote Control WordPress
 
WordPress CLI in-depth
WordPress CLI in-depthWordPress CLI in-depth
WordPress CLI in-depth
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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, ...
 
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...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Command Line WordPress with WP-CLI - WordPress Perth User Group

  • 1. Command Line WordPress with WP-CLI ! James Collins ! @om4james http://jamesc.id.au/ ! ! WordPress Perth User Group - October 2014
  • 2. What is WP-CLI? A tool for managing WordPress installations Uses the command line (not a web browser) 2
  • 3. Why? (Usually) faster than using a mouse Powerful - automate/script common tasks Saves time when managing lots of WordPress installations (including Multisite) Active open source project with 90+ contributors 3
  • 4. Usage Install WP-CLI once on your computer/server http://wp-cli.org/ Navigate to a WordPress install: cd /path/to/wordpress/install/ Run the ‘wp’ command: wp 4
  • 5. What Can It Do? 5
  • 6. My Favourite Uses for WP-CLI 6
  • 7. Staying up-to-date 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) 7
  • 8. Database Search/Replace Search/replace in all tables in the database Useful when changing domain names wp search-replace 'http://example.dev' 'http://example.com' —dry-run (Will correctly handle serialized values) 8
  • 9. WordPress Media/Uploads Regenerate/recreate WordPress thumbnails: wp media regenerate Useful after changing image size settings, or switching themes 9
  • 10. Bulk User Management Bulk Import 1000+ Users The CSV file / spreadsheet: ! ! wp user import-csv --skip-update users.csv Full Details: http://jamesc.id.au/?p=1157 10
  • 11. Bulk User Management Bulk Delete all subscriber users: wp user list --role=subscriber --field=ID | xargs wp user delete --yes Full Details: http://jamesc.id.au/?p=1157 11
  • 12. Also: Install WordPress Database import/export Change WordPress options Heaps more! 12
  • 13. Questions? http://wp-cli.org/ https://github.com/wp-cli/wp-cli These slides are online at: http://jamesc.id.au/wp-cli-perth/ 13