Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Getting Started with WP-CLI, a tool to automate your life

61 views

Published on

Learn the basics around WP-CLI and how to get started using it locally, in production, and to help make simple tasks automated.

Published in: Engineering
  • Be the first to comment

Getting Started with WP-CLI, a tool to automate your life

  1. 1. Getting Started with WP-CLI, a tool to automate your life @ajmorris
  2. 2. What is it? WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser. Recently has been brought under the WordPress project. Current Maintainer: Daniel Bachhuber @ajmorris
  3. 3. Command-Line say What?!? Don’t fear the command-line! @ajmorris
  4. 4. What type of tools can I use? • Download, install, update and manage WordPress core • Install, Activate, Deactivate WordPress themes and plugins • Manage WP-Cron events and schedules • Manage Attachment • Manage and backup Database @ajmorris
  5. 5. What type of tools can I use? • Perform basic database operations • Publish posts • User Management: Add, Remove, Update Roles • Manage Comments • And it’s extendable @ajmorris
  6. 6. Requirements • UNIX-like environment (OS X, Linux, FreeBSD, Cygwin) • PHP 5.3.29 or later • WordPress 3.7 or later @ajmorris
  7. 7. Install WP-Cli $ curl -O https://raw.githubusercontent.com/wp-cli/ builds/gh-pages/phar/wp-cli.phar $ php wp-cli.phar -- info $ chmod +x wp-cli.phar $ sudo mv wp-cli.phar /usr/local/bin/wp @ajmorris
  8. 8. Hosts WP-Cli Installed @ajmorris
  9. 9. Local Development Varying Vagrant Vagrants - http://ajmorris.us/WPVVV Local by Flywheel - http://ajmorris.us/localflywheel Docker - http://ajmorris.us/wdocker DockerWP - http://ajmorris.us/DockerWP WP Docker - http://ajmorris.us/wp-docker @ajmorris
  10. 10. Install WordPress $ wp core download $ wp core install --url=world.com --title=Doman --admin_user=somethinglong --admin_password=strongpassword --admin_email=hello@world.com @ajmorris
  11. 11. Manage Themes $ wp theme $ wp theme search $ wp theme list $ wp theme activate <theme_name> @ajmorris
  12. 12. Manage Themes $ wp theme status <theme_name> $ wp theme update $ wp theme is-installed $ wp theme path @ajmorris
  13. 13. Manage Plugins $ wp plugin list $ wp plugin install <plugin-slug> $ wp plugin activate <plugin-slug> $ wp plugin update <plugin-slug> @ajmorris
  14. 14. Manage Plugins $ wp plugin list --update=available $ wp plugin list --fields=name,version @ajmorris
  15. 15. Manage Cron Tasks $ wp cron event list $ wp cron event schedule <hook> <next-run> <recurrence> $ wp cron event delete <hook> @ajmorris
  16. 16. Media Import $ wp media import <file> $ wp media regenerate @ajmorris
  17. 17. Manage Database $ wp db cli $ wp db optimize $ wp db export <file_name> $ wp db import <file_name> @ajmorris
  18. 18. Manage Database $ wp db tables $ wp db reset --yes $ wp search-replace “old-url” “new-url” @ajmorris
  19. 19. Manage WordPress Options $ wp option get db_version $ wp option get current_theme $ wp option get blogname $ wp option get admin_email @ajmorris
  20. 20. Manage Users $ wp user list $ wp user create newuser <email> -- role=administrator --user_pass=123aqe -- display_name=“AJ Morris” $ wp user list -- fields=user_login,display_name,user_name,roles @ajmorris
  21. 21. Manage Cache & Transients $ wp cache flush $ wp transient delete-expired $ wp rewrite structure ‘%postname%’ $wp rewrite flush @ajmorris
  22. 22. Manage Posts $ wp post list --fields=ID,post_title,post_status $ wp post create --post_type=post --post_title=‘A WordCamp Jackson’ --post_status=draft $ wp post edit <id> @ajmorris
  23. 23. Demo Time Let’s Jump into the Command Line! @ajmorris
  24. 24. About Me Product Marketing Liquid Web Twitter: @ajmorris Blog: https://ajmorris.me @ajmorris
  25. 25. Questions? @ajmorris
  26. 26. Thank You! @ajmorris

×