Save 37% off PRO during our Black Friday Sale! »

Hollywood WordPress - CLI For WordPress (an Introduction)

Hollywood WordPress - CLI For WordPress (an Introduction)

Presented by Mike Schroder at the Hollywood WordPress Meetup.

Introductory presentation on using the command line to make life easier for developers and designers alike.

Covers command line basics, followed by an introduction to WP-CLI for those who'd like to dig deeper and manage WordPress directly using the CLI.


Mike Schroder

July 10, 2013


  1. CLI for WordPress an introduction Hollywood WordPress Meetup Mike Schroder

    (DH-Shredder) @GetSource -
  2. Who Am I? • Mike Schroder, a.k.a DH-Shredder, a.k.a. @GetSource

    • Third Culture Kid, enjoy Coffee & Sailing • WordPress Core and wp-cli Contributor • Happy DreamHost Employee
  3. There are two groups of people.

  4. Those who use the command line

  5. Those who are going to use the command line

  6. Don’t be afraid of the CLI. It’s your friend.

  7. Oh, you like the CLI? wp-cli will make your life

  8. Command Line Interface: A direct, text-based, interface to a computer.

  9. A direct, text-based, interface to your server.

  10. At your host, you’ll see this referred to as SSH.

  11. Perform operations directly on your server.

  12. None
  13. None
  14. Why would I use the CLI?

  15. Efficiency! Get things done faster.

  16. Copying a WordPress install in SFTP?

  17. ~5 Minutes+

  18. Copying a WordPress install in SSH?

  19. ~10 Seconds

  20. What else can I do?

  21. Deploy your site.

  22. On-server file editing.

  23. Plugin and theme installation or updates.

  24. Commands and Arguments $ cmd <required arg> [optional arg]

  25. Windows Instructions: - Install Putty:

  26. None
  27. Mac Instructions: Open Terminal, then: $ ssh [user@]<your_host_address>

  28. What are some basic commands?

  29. List files $ ls [-a] [location] -a for all files,

    including hidden
  30. Change directory $ cd <location> Use ~ for home. ../

    to go up a directory.
  31. Copy files $ cp [-r] <source> <dest> -r copies recursively.

  32. Remove files $ rm [-r] <location> -r removes recursively.

  33. Move files or directories $ mv <source> <dest>

  34. Download files $ wget <http://somesite/>

  35. Unzip files $ unzip <>

  36. WordPress specific CLI operations: WP-CLI

  37. Super-cool Open Source tool to manage WordPress

  38. Headed up by Cristi Burcă (scribu) and Andreas Creten

  39. Uses WordPress itself to perform operations

  40. Automation!

  41. What can I do with it?

  42. None
  43. No, Really.

  44. Update WordPress $ wp core update

  45. Install a Theme $ wp theme install <slug>

  46. Change Theme $ wp theme activate <slug>

  47. Backup your Database $ wp db export [filename]

  48. Update Plugins $ wp plugin update-all

  49. Update Themes $ wp theme update-all

  50. What do I need to run it? • SSH access

    to your WordPress install's directory • PHP 5.3+ • WordPress 3.3+ • Enough RAM for shell processes to run WordPress • Easiest on Linux & MacOS
  51. Okay. Got that covered. How can I get this Awesomeness?

  52. Install WP-CLI Full Instructions at In short, from the

    root of your user: curl | bash
  53. If you’re local and have sudo: sudo utils/dev-build

  54. Otherwise, add an alias (.bashrc/.bash_profile) alias wp='/home/user/wp-cli/src/bin/wp';

  55. In ~/.bash_profile: if [ -f ~/.bashrc ]; then source ~/.bashrc

    fi (
  56. You’ve got it installed? Let’s dig deeper.

  57. WP-CLI is extensible.

  58. Add your own directly wp-cli/php/commands/community/cmd_name.php

  59. Or, define in your plugins. if ( defined('WP_CLI') && WP_CLI

    ) { ! include( PLUGIN_DIR . '/lib/wp-cli.php' ); }
  60. Sample Backup Plugin:

  61. This is just a start.

  62. None
  63. Resources! • • • • • • Mike Schroder (DH-Shredder) @GetSource -