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
310
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
120
Building Pages in WordPress
kjohnson
0
140
Gutenberg
kjohnson
0
360
Separate your time from your income
kjohnson
0
410
iThemes Exchange
kjohnson
0
90
Easy Digital Downloads
kjohnson
0
81
PHP Templating
kjohnson
0
130
WordPress Taxonomies
kjohnson
0
80
objects-a-short-intro.pdf
kjohnson
0
170
Other Decks in Programming
See All in Programming
PHP ステートレス VS ステートフル 状態管理と並行性 / php-stateless-stateful
ytake
0
110
Lottieアニメーションをカスタマイズしてみた
tahia910
0
130
.NET Frameworkでも汎用ホストが使いたい!
tomokusaba
0
160
2024年のWebフロントエンドのふりかえりと2025年
sakito
3
260
プログラミング言語学習のススメ / why-do-i-learn-programming-language
yashi8484
0
140
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.4k
Unity Android XR入門
sakutama_11
0
160
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
2
580
Multi Step Form, Decentralized Autonomous Organization
pumpkiinbell
1
780
Pulsar2 を雰囲気で使ってみよう
anoken
0
240
How mixi2 Uses TiDB for SNS Scalability and Performance
kanmo
40
15k
『品質』という言葉が嫌いな理由
korimu
0
170
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
114
50k
GitHub's CSS Performance
jonrohan
1030
460k
Why Our Code Smells
bkeepers
PRO
336
57k
Typedesign – Prime Four
hannesfritz
40
2.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
Practical Orchestrator
shlominoach
186
10k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Raft: Consensus for Rubyists
vanstee
137
6.8k
Mobile First: as difficult as doing things right
swwweet
223
9.3k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
560
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.3k
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