Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Command Line WordPress 
with WP-CLI 
! 
James Collins 
! 
@om4james 
http://jamesc.id.au/ 
! 
! 
WordPress Perth User Grou...
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 WordP...
Usage 
Install WP-CLI once on your computer/server 
http://wp-cli.org/ 
Navigate to a WordPress install: 
cd /path/to/word...
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 
U...
Database Search/Replace 
Search/replace in all tables in the database 
Useful when changing domain names 
wp search-replac...
WordPress Media/Uploads 
Regenerate/recreate WordPress thumbnails: 
wp media regenerate 
Useful after changing image size ...
Bulk User Management 
Bulk Import 1000+ Users 
The CSV file / spreadsheet: 
! 
! 
wp user import-csv --skip-update users.c...
Bulk User Management 
Bulk Delete all subscriber users: 
wp user list --role=subscriber --field=ID | 
xargs wp user delete...
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-...
Upcoming SlideShare
Loading in …5
×

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

12,033 views

Published on

How to use WP-CLI to manage your WordPress installations. Easily bulk import users, update core/plugins/themes, perform database search/replaces, and more!

A presentation given at the WordPress Perth User Group October 2014 Meetup: http://www.meetup.com/WordPress-Perth/events/209200412/

Published in: Technology
  • Hi! Get Your Professional Job-Winning Resume Here! 👉 http://bit.ly/rexumtop
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

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

  1. 1. Command Line WordPress with WP-CLI ! James Collins ! @om4james http://jamesc.id.au/ ! ! WordPress Perth User Group - October 2014
  2. 2. What is WP-CLI? A tool for managing WordPress installations Uses the command line (not a web browser) 2
  3. 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. 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. 5. What Can It Do? 5
  6. 6. My Favourite Uses for WP-CLI 6
  7. 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. 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. 9. WordPress Media/Uploads Regenerate/recreate WordPress thumbnails: wp media regenerate Useful after changing image size settings, or switching themes 9
  10. 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. 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. 12. Also: Install WordPress Database import/export Change WordPress options Heaps more! 12
  13. 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

×