Manage WordPress Easily with WP-CLI
Ajit Bohra, Hardeep Asrani & Gagan Deep Singh
How many of you are Command Line users?
How many of you are using WP-CLI?
What is WP-CLI?
Why not WP-CLI?
Which one was easier?
Expectations &Takeaways
Let’s get started!
Install WP-CLI
# Install WP-CLI
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

# Make the file executable

$ chmod +x wp-cli.phar

# Move it to somewhere in your PATH

$ sudo mv wp-cli.phar /usr/local/bin/wp
# Test WP-CLI.
$ wp —info
Source: wp-cli.org
Command Structure
$ wp plugin install wordpress-seo --activate
command subcommand parameter flag
Useful Commands
Plugin Commands: Install & Activate
$ wp plugin install bbpress --activate
Plugin Commands: Deactivate
$ wp plugin deactivate bbpress
Plugin Commands: Delete
$ wp plugin delete bbpress
Theme Commands: Install & Activate
$ wp theme install make --activate
Theme Commands: Deactivate
$ wp theme deactivate make
Theme Commands: Delete
$ wp theme delete make
Manage Users: List Users
$ wp user list
Manage Users: Create User
$ wp user create harry ex@ample.com --role=author
Manage Users: Change Password
$ wp user create bob bob@example.com --role=author
Manage Users: Delete User
$ wp user delete 10
Manage Media: Upload Media
$ wp media import https://example.com/image.png
Manage Media: Regenerate Media
$ wp media regenerate --yes
Manage Posts: Create Posts
$ wp post create --post_type=page --post_title='A sample post'
Manage Posts: Edit Posts
$ wp post edit 123
Manage Posts: Generate Posts
$ wp post generate --count=10 --post_type=page --post_date=1999-01-04
Export/Import Posts: Generate Posts
$ wp export
Export/Import Posts: Generate Posts
$ wp import example.wordpress.2016-06-21.xml --authors=create
Search/Replace
$ wp search-replace ‘http://old-site.com' ‘http://new-site.com'
Now it’s your time.
Resources
http://wp-cli.org/
https://developer.wordpress.org/cli/commands/
https://local.getflywheel.com/
https://commandlinepoweruser.com/
https://serversforhackers.com/
https://mediatemple.net/community/products/dv/204403684/
connecting-via-ssh-to-your-server
Thank you.

Workshop On WP-CLI