+ All Categories
Home > Technology > Command Line WordPress with WP-CLI - WordPress Perth User Group

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

Date post: 25-Jan-2015
Category:
Upload: james-collins
View: 2,463 times
Download: 0 times
Share this document with a friend
Description:
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/
13
Command Line WordPress with WP-CLI James Collins @om4james http://jamesc.id.au/ WordPress Perth User Group - October 2014
Transcript
Page 1: Command Line WordPress with WP-CLI - WordPress Perth User Group

Command Line WordPress with WP-CLI

!James Collins

!@om4james

http://jamesc.id.au/ !!

WordPress Perth User Group - October 2014

Page 2: Command Line WordPress with WP-CLI - WordPress Perth User Group

What is WP-CLI?

A tool for managing WordPress installations

Uses the command line (not a web browser)

2

Page 3: Command Line WordPress with WP-CLI - WordPress Perth User Group

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

Page 4: Command Line WordPress with WP-CLI - WordPress Perth User Group

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

Page 5: Command Line WordPress with WP-CLI - WordPress Perth User Group

What Can It Do?

5

Page 6: Command Line WordPress with WP-CLI - WordPress Perth User Group

My Favourite Uses for WP-CLI

6

Page 7: Command Line WordPress with WP-CLI - WordPress Perth User Group

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

Page 8: Command Line WordPress with WP-CLI - WordPress Perth User Group

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

Page 9: Command Line WordPress with WP-CLI - WordPress Perth User Group

WordPress Media/Uploads

Regenerate/recreate WordPress thumbnails: wp media regenerate

Useful after changing image size settings, or switching themes

9

Page 10: Command Line WordPress with WP-CLI - WordPress Perth User Group

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

Page 11: Command Line WordPress with WP-CLI - WordPress Perth User Group

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

Page 12: Command Line WordPress with WP-CLI - WordPress Perth User Group

Also:

Install WordPress

Database import/export

Change WordPress options

Heaps more!

12

Page 13: Command Line WordPress with WP-CLI - WordPress Perth User Group

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


Recommended