Playing with WP-CLI (WordPress Command Line Interface)

25
./WP-CLI http://wp-cli.org

description

WP-CLI, WordPress Command Line Interface is the newer and faster way to interact with WordPress, and anything related to it. It's fun and easy. This presentation gives a good idea on Wordpress CLI and It's usages

Transcript of Playing with WP-CLI (WordPress Command Line Interface)

Page 1: Playing with WP-CLI (WordPress Command Line Interface)

./WP-CLIhttp://wp-cli.org

Page 2: Playing with WP-CLI (WordPress Command Line Interface)

CLI? What is it anyways?

Page 3: Playing with WP-CLI (WordPress Command Line Interface)

Command Line Interface

Page 4: Playing with WP-CLI (WordPress Command Line Interface)

So, WP-CLI is,

● A way to interact with WordPress using command line.

● Alternatively, a set of command line tools, to interact with WordPress

Page 5: Playing with WP-CLI (WordPress Command Line Interface)

Requirements

● *nix environment (Linux, Mac OSX, BSD)● Windows user? Use Cygwin● PHP 5.3.2+ (with php cli)● WordPress 3.4+

Page 6: Playing with WP-CLI (WordPress Command Line Interface)

Installation#download from server

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

#make executable

>chmod +x wp-cli.phar

#move inside search path, now has alias “wp”

>sudo mv wp-cli.phar /usr/local/bin/wp

Page 7: Playing with WP-CLI (WordPress Command Line Interface)

Access it from command line

wp --info

PHP binary: /usr/bin/php5PHP version: 5.5.3-1ubuntu2.6php.ini used: /etc/php5/cli/php.iniWP-CLI root dir: phar://wp-cli.pharWP-CLI global config:WP-CLI project config:WP-CLI version: 0.15.1

Good news! If you get something like this :

Page 8: Playing with WP-CLI (WordPress Command Line Interface)

So, What can it do for me?

● Almost anything● Sorry, It can't make you coffee ( - ryanduff)

Page 9: Playing with WP-CLI (WordPress Command Line Interface)

What's the point then?

Page 10: Playing with WP-CLI (WordPress Command Line Interface)

The main point is:

Page 11: Playing with WP-CLI (WordPress Command Line Interface)
Page 12: Playing with WP-CLI (WordPress Command Line Interface)

New Installation

wp core download

it just downloads WordPress.

For installation, read the documentation

Page 13: Playing with WP-CLI (WordPress Command Line Interface)

Documentation at

http://wp-cli.org/commands/

Page 14: Playing with WP-CLI (WordPress Command Line Interface)

Search and replace

wp search-replace "WordPress" "Awesome WordPress" wp_posts

Page 15: Playing with WP-CLI (WordPress Command Line Interface)

Export and import

#export

wp export --dir=backup

#import

wp import backup/hello.wordpress.2014-07-17.0.xml --authors=create

Page 16: Playing with WP-CLI (WordPress Command Line Interface)

Installing and activating plugins

wp plugin install wp-user-frontend --activate

Page 17: Playing with WP-CLI (WordPress Command Line Interface)

Other thing with plugins

● Listing● Searching● Deleting● Activate/Deactivate/Toggle

● update

Page 18: Playing with WP-CLI (WordPress Command Line Interface)

Themes

● Yes!

Page 19: Playing with WP-CLI (WordPress Command Line Interface)

And some other features

● User management● Comments● Media● Options● …......

Page 20: Playing with WP-CLI (WordPress Command Line Interface)

Multi Site?

Yes.

Page 21: Playing with WP-CLI (WordPress Command Line Interface)

Extending?

Page 22: Playing with WP-CLI (WordPress Command Line Interface)

Yeah sure!

https://github.com/wp-cli/wp-cli/wiki/Commands-Cookbook

Page 23: Playing with WP-CLI (WordPress Command Line Interface)
Page 24: Playing with WP-CLI (WordPress Command Line Interface)

Questions?

Page 25: Playing with WP-CLI (WordPress Command Line Interface)

A bit about myself

Anam Ahmedhttp://anam.co

fb.me/theanam

@mranam