1
Speaker
Aditya Shah
WordCamp Nepal 2022
5-6 November. 2022
Bharatpur, Nepal
HI!
2
3
WP- CLI
4
INTRODUCTION
5
Let’s start!
6
What is WP-CLI?
7
Why WP-CLI?
8
Who this is for?
Anyone really, but mostly:
9
Let’s get started?
What would you need-
•Install : https://wp-cli.org/
•Requires PHP 5.3.2 or later
•Requires Wordpress 3.5.2. or later
A “UNIX-like” environment:
•OSX (Macintosh)
•Linux
•Cygwin (Windows)
10
Installing WP-CLI
$ curl -0 https://raw.githubusercont
$ chmod +x wp-cli.phar
$ mv wp-cli.phar /usr/local/bin/wp
$ wp - -info
11
12
Running Commands
wp <command> <sub-command> <params>
13
Running Commands
<param> – required
[--param] – optional flag
[--param=<value>] — optional w/ value
14
Core
Downloads, installs, updates & manages a WordPress installation.
$ wp core download
15
db
Performs basic database operations using credentials stored in wp-config.php.
wp db export backup.sql
wp db import backup.sql
wp db cli
16
Search-replace
Searches/replaces strings in the database, including serialised arrays.
$ wp search-replace
‘foo’ ‘bar’
17
Post
wp post generate –count=500
wp plugin install any-ipsum —activate
wp any-ipsum generate posts 100
18
Media
Regenerate thumbnails
wp media regenerate —yes
19
Create users
wp user create
wp user generate
wp user import-csv
20
21
Let’s Connect
@ethicaladitya
@wpmudev
22
THANK YOU!
23