Command Line WordPress
with WP-CLI
James Collins
@om4james
http://jamesc.id.au/
WordPress Melbourne User Group - September...
What is WP-CLI?
A command line tool for managing WordPress
installations
Uses the command line (not a web browser)
http://...
Why?
(Usually) faster than using a mouse
Powerful - automate/script common tasks
Useful when managing lots of WordPress
in...
Usage
Install WP-CLI once on your computer/server
Navigate to a WordPress install:
cd /path/to/wordpress/install/
Run the ...
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 ...
WordPress Plugins (cont.)
Install a plugin from WordPress.org:
wp plugin install facebook
Activate a plugin:
wp plugin act...
WordPress Themes
Update all themes:
wp theme update-all
List all themes:
wp theme status
I = Inactive, A = Active, U = Upd...
WordPress Themes (cont.)
Install a theme from WordPress.org:
wp plugin install quark
Activate a theme:
wp theme activate q...
Update Everything!
Update WordPress, plugins & themes:
wp core update && wp plugin update-all &&
wp theme update-all
Use t...
Database Search/Replace
Search/replace in all tables in the database
Will correctly handle serialized values
Useful when c...
WordPress Media/Uploads
Regenerate/recreate WordPress thumbnails:
wp media regenerate
Useful after changing image size set...
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' --ac...
Download & Install WordPress
cd /path/to/empty/directory/
wp core download
wp core config --dbname=wpcli --
dbuser=wpcli --...
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
Upcoming SlideShare
Loading in …5
×

Command Line WordPress with WP-CLI

17,770 views

Published on

How to use WP-CLI to manage your WordPress Installations. Using WP-CLI you can:
Install WordPress, update WordPress, install plugins, update plugins, database search and replace, create test posts and pages, create new plugins, manage comments, manage users, perform database imports/exports, and more.

A presentation given that the WordPress Melbourne User Group September 2013 Meetup (http://www.meetup.com/WordPress-Melbourne/events/112574042/).

Published in: Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
17,770
On SlideShare
0
From Embeds
0
Number of Embeds
14,237
Actions
Shares
0
Downloads
3
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Command Line WordPress with WP-CLI

  1. 1. Command Line WordPress with WP-CLI James Collins @om4james http://jamesc.id.au/ WordPress Melbourne User Group - September 2013
  2. 2. 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
  3. 3. 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
  4. 4. 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
  5. 5. What Can It Do? 5
  6. 6. WordPress Core Update WordPress core: wp core update Upgrade WordPress database: wp core update-db 6
  7. 7. 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
  8. 8. 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
  9. 9. WordPress Themes Update all themes: wp theme update-all List all themes: wp theme status I = Inactive, A = Active, U = Update Available 9
  10. 10. 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
  11. 11. 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
  12. 12. 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
  13. 13. WordPress Media/Uploads Regenerate/recreate WordPress thumbnails: wp media regenerate Useful after changing image size settings, or switching themes 13
  14. 14. Create Posts Create 100 posts: wp post generate --count=100 14
  15. 15. Create Pages Create 100 pages, 3 levels deep: wp post generate --count=100 --post_type=page --max_depth=3 15
  16. 16. 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
  17. 17. Download & Install WordPress cd /path/to/empty/directory/ wp core download wp core config --dbname=wpcli -- dbuser=wpcli --dbpass=wpcli wp core install 17
  18. 18. Also: Add/manage comments Add/manage users Database import/export Change WordPress options Heaps more! 18
  19. 19. Questions? http://wp-cli.org/ https://github.com/wp-cli/wp-cli These slides are online at: http://jamesc.id.au/wp-cli/ 19

×