Top Banner
Blog - shawnhooper.ca Twitter - @shawnhooper WP-CLI: Save Time by Managing WordPress from the Command Line WordCamp Rochester 2016 Shawn Hooper Director of IT, actionable.co
20

Save Time By Manging WordPress from the Command Line

Feb 15, 2017

Download

Internet

Shawn Hooper
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

WP-CLI: Save Time by Managing

WordPress from the Command Line

WordCamp Rochester 2016

Shawn Hooper Director of IT, actionable.co

Page 2: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

WP-CLI is a set of tools that allows you to manage your WordPress website from the command line.

https://wp-cli.org/

What is WP-CLI ?

Page 3: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

I 💖 The Command Line

Page 4: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

Site / Server Administrators

Plugin Developers

Theme Designers

… anyone who wants to do more in less time.

Who Is It For?

Page 5: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

Don’t Be Afraid

Page 6: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

WP-CLI, available at wp-cli.org

UNIX-like environment (OS X, Linux, FreeBSD, Cygwin); limited support in Windows environment

PHP 5.3.29 or later

WordPress 3.7 or later

What do you need?

Page 7: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

You need to have SSH access to use WP-CLI.

Not all web hosts allow SSH access.

SiteGround, Pantheon, BlueHost, GoDaddy, Media Temple, Windows Azure and more now have CLI

support.

It also works great with VPS services like DigitalOcean, Linode and Amazon Web Services.

In Production…

Page 8: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

Download it:

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Set permissions: chmod +x wp-cli.phar

Move it somewhere useful:sudo mv wp-cli.phar /usr/local/bin/wp

Installing WP-CLI

Page 9: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

Does It Work?

> wp

Installing WP-CLI

Page 10: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

Page 11: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

That was the hard part.

Congratulations!

Page 12: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

wp <command> <sub-command> <params>

Running Commands

Page 13: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

<param> — required

[--param] — optional flag

[--param=<value>] — optional w/ value

Running Commands

Page 14: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

The --prompt flag

guides you through parameters.

The --help parameteron any command will tell you what it does,

the parameters it accepts, etc.

Running Commands

Page 15: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

Page 16: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

WP-CLI packages are community-maintained

commands you can install with

wp package install

http://wp-cli.org/package-index/

Packages

Page 17: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

Plugins that include WP-CLI commands

as a feature.

http://wp-cli.org/docs/tools/

Tools

Page 18: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

Page 19: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

Advanced Custom Fields (ACF) Any Ipsum

BackupBuddy Google Site Map Generator

WP DB Migrate ProRedis Object Cache

WP Revisions CLI

…. and more.

Tools

Page 20: Save Time By Manging WordPress from the Command Line

Blog - shawnhooper.ca Twitter - @shawnhooper

You can find these slides, notes and more atshawnhooper.ca

Tweet Me @shawnhooper

WordPress Slack: shooper

Thank You!