Slide 1

Slide 1 text

The command line interface for WordPress_ ./WP-CLI

Slide 2

Slide 2 text

$ 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.

Slide 3

Slide 3 text

$ wp core download Downloading WordPress 4.8 Md5 hash verified: c5366d0521831dd029dfc38e56a5 Success: WordPress downloaded.

Slide 4

Slide 4 text

$ wp core install Success: WordPress installed successfully.

Slide 5

Slide 5 text

$ wp plugin update Updating to version 4.9 Downloading update... Unpacking the update... Success: WordPress updated successfully.

Slide 6

Slide 6 text

Use Cases

Slide 7

Slide 7 text

Example Use Cases • Plugin/Theme Development • Local Development Environments • Client Site Maintenance • WordPress as a Service

Slide 8

Slide 8 text

Plugin/Theme Development • Scaffold new plugins • Run PHPUnit tests

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

Client Site Maintenance • Remotely Update WordPress (SSH) • Check for plugin updates • Restore down sites (white-screen of death) $ wp plugin deactivate --skip-plugins Success: Plugin deactivated.

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

Extending WP-CLI

Slide 13

Slide 13 text

$ wp ninja-forms list-forms public function list_forms( $args, $assoc_args ) { foreach( Ninja_Forms()->forms() as $form ){ WP_CLI::line( ‘#’ . $form[‘title’] ); } }

Slide 14

Slide 14 text

Outside of WordPress

Slide 15

Slide 15 text

Laravel $ artisan # Generate a new controller. $ artisan make:controller PostController # Re-run database migration with seed data. $ artisan migrate:refresh --seeds

Slide 16

Slide 16 text

Drupal $ drush # Run pending updates on staging site. $ drush @staging updatedb # Synchronize staging files to production. $ drush rsync @staging @ list