Slide 1

Slide 1 text

Advanced WP CLI A WPLeeds talk by Tom J Nowell

Slide 2

Slide 2 text

I’m Tom J Nowell Code For The People

Slide 3

Slide 3 text

I’ll Cover ● What is WP CLI ● Some WP CLI Commands & Usage ● Demo

Slide 4

Slide 4 text

WP CLI WordPress, Command Line Interface A tool for terminal users

Slide 5

Slide 5 text

What is The Terminal?

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Once installed, open your WordPress folder on the terminal GIF by Chris Coyier of CSS Tricks

Slide 8

Slide 8 text

Some of the Things WP CLI Can Do ● Create Posts ● Create Users ● Download plugins and themes ● Database Queries ● Installing WordPress

Slide 9

Slide 9 text

E.g. Adding an author to a site: ❯ wp user create bob [email protected] --role=author

Slide 10

Slide 10 text

Listing activated plugins ❯ wp plugin list --status=active -- format=csv --fields=name

Slide 11

Slide 11 text

Doing a Search replace ❯ wp search-replace oldsite.com newsite.com

Slide 12

Slide 12 text

List blogs, and their URLs in a multisite ❯ blogs=$(wp site list --fields="site_id, blog_id,url" --format="csv") for entry in $blogs do site_id=$(echo $entry |cut -d ',' -f1 ) blog_id=$(echo $entry |cut -d ',' -f2 ) blog_url=$(echo $entry |cut -d ',' -f3 ) echo "$blog_id: $blog_url in $site_id" done

Slide 13

Slide 13 text

A demonstration

Slide 14

Slide 14 text

Questions? Tom J Nowell @tarendai tomjn.com