Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to WP-CLI
Search
Kyle B. Johnson
November 02, 2017
Programming
0
290
Introduction to WP-CLI
Kyle B. Johnson
November 02, 2017
Tweet
Share
More Decks by Kyle B. Johnson
See All by Kyle B. Johnson
Continuously Delivering Value
kjohnson
0
85
Building Pages in WordPress
kjohnson
0
100
Gutenberg
kjohnson
0
330
Separate your time from your income
kjohnson
0
340
iThemes Exchange
kjohnson
0
60
Easy Digital Downloads
kjohnson
0
70
PHP Templating
kjohnson
0
96
WordPress Taxonomies
kjohnson
0
76
objects-a-short-intro.pdf
kjohnson
0
140
Other Decks in Programming
See All in Programming
MetricKitで予期せぬ終了を検知する話 / Detect unexpected termination with MetricKit
nekowen
1
190
Apache Hive 4 on Treasure Data
ryukobayashi
0
320
Git Rebase
bkuhlmann
11
1.6k
Fast JSX: Don't clone props object #28768
yossydev
1
100
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
4.1k
Random\Randomizer クラスで日常のあれこれを解決しよう! / Random\Randomizer class solves familiar trouble
cocoeyes02
0
240
Elm 0.19.0 Changes
bkuhlmann
0
490
OpenAPIを中心に考えるAPI開発入門 / Introduction to API Development with a Focus on OpenAPI
seike460
PRO
2
170
Git Lint
bkuhlmann
4
750
2 週間で Twitter Bot を作ってみた
contour_gara
0
390
TCAとKMPを用いた新規動画配信アプリ 「ABEMA Live」の設計
tomu28
1
110
大規模Reactアプリのリアーキテクチャ~8万行のTanStack Query移行の軌跡~
kj455
4
960
Featured
See All Featured
Visualization
eitanlees
136
14k
Web Components: a chance to create the future
zenorocha
305
41k
Building Your Own Lightsaber
phodgson
99
5.7k
Six Lessons from altMBA
skipperchong
21
3k
Raft: Consensus for Rubyists
vanstee
132
6.3k
The Invisible Side of Design
smashingmag
294
49k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
322
20k
A designer walks into a library…
pauljervisheath
200
23k
The Illustrated Children's Guide to Kubernetes
chrisshort
31
46k
Infographics Made Easy
chrislema
238
18k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
Navigating Team Friction
lara
178
13k
Transcript
The command line interface for WordPress_ ./WP-CLI
$ wp plugin install ninja-forms Installing Ninja Forms (3.0) Downloading
install package... Unpacking the package... Installing the plugin... Plugin installed successfully. Success: Installed 1 of 1 plugins.
$ wp core download Downloading WordPress 4.8 Md5 hash verified:
c5366d0521831dd029dfc38e56a5 Success: WordPress downloaded.
$ wp core install Success: WordPress installed successfully.
$ wp plugin update Updating to version 4.9 Downloading update...
Unpacking the update... Success: WordPress updated successfully.
Use Cases
Example Use Cases • Plugin/Theme Development • Local Development Environments
• Client Site Maintenance • WordPress as a Service
Plugin/Theme Development • Scaffold new plugins • Run PHPUnit tests
Local Development Environments • Download/Install/Update WordPress • Auto install plugins/themes
• Search/Replace database values (site migration) • Launch PHP’s built-in web server $ wp serve –-host=wordpress.dev ~/code/wordpress now available at wordpress.dev:80
Client Site Maintenance • Remotely Update WordPress (SSH) • Check
for plugin updates • Restore down sites (white-screen of death) $ wp plugin deactivate <plugin name> --skip-plugins Success: Plugin <plugin name> deactivated.
WordPress as a Service • Check for updates • Create
user accounts • Create new installs $ wp site create --slug=example Success: Site 3 created. wordpress.dev/example
Extending WP-CLI
$ wp ninja-forms list-forms public function list_forms( $args, $assoc_args )
{ foreach( Ninja_Forms()->forms() as $form ){ WP_CLI::line( ‘#’ . $form[‘title’] ); } }
Outside of WordPress
Laravel $ artisan # Generate a new controller. $ artisan
make:controller PostController # Re-run database migration with seed data. $ artisan migrate:refresh --seeds
Drupal $ drush # Run pending updates on staging site.
$ drush @staging updatedb # Synchronize staging files to production. $ drush rsync @staging @ list