Successfully reported this slideshow.
Your SlideShare is downloading. ×

Session: WP Site Management using WP-CLI from Scratch

Check these out next

1 of 55 Ad
1 of 55 Ad

Session: WP Site Management using WP-CLI from Scratch

Download to read offline

In these slides, you will learn how to install WP-CLI and how to use it.

Originally presented in WordCamp Iloilo Aug 24, 2019

In these slides, you will learn how to install WP-CLI and how to use it.

Originally presented in WordCamp Iloilo Aug 24, 2019

Advertisement
Advertisement

More Related Content

Slideshows for you (19)

Similar to Session: WP Site Management using WP-CLI from Scratch (20)

Advertisement

Session: WP Site Management using WP-CLI from Scratch

  1. 1. Session: WP Site Management using WP-CLI from ScratchRoald Umandal WordCamp Iloilo August 24, 2019
  2. 2. Agenda ● What is WP-CLI? ● WP-CLI Installation ● WP-CLI Demo
  3. 3. Who am I? Roald Umandal Customer Success Engineer in Pantheon Systems
  4. 4. Fun Facts About Me ● Was asked few times if my name is derived from the famous book author of “Charlie and the Chocolate Factory” - Roald Dahl ● PHP backend developer (Drupal/WordPress) ● I run in marathon ● I love travelling and photography ● We are three in family with same birthday ● I have Golden Retriever his name is “Khalil” Arabic name that means “Friend”
  5. 5. What is WP-CLI? WP-CLI is command line utility tool that makes developer life easy. Manage sites in just few lines without navigating directly in browser (hate many clicks?). You can update plugins, configure multisite installs and much more, without using a web browser.
  6. 6. WP-CLI Installation
  7. 7. WP-CLI Installation ● UNIX-like environment (OS X, Linux, FreeBSD, Cygwin); limited support in Windows environment ● PHP 5.4 > ● WordPress 3.7 or later. (Note: Versions older than the latest WordPress release may have degraded functionality)
  8. 8. WP-CLI Installation 1. Download the wp-cli.phar file using wget or curl:
  9. 9. WP-CLI Installation 2. Check Phar file to verify it’s working:
  10. 10. WP-CLI Installation 3. Make the file executable and move under /usr/local/bin to run WP-CLI globally:
  11. 11. WP-CLI Installation 4. Verify WP-CLI if installed properly
  12. 12. Docker image LAMP https://hub.docker.com/r/roaldumandal/ wordcamp-iloilo
  13. 13. Local development environment tools that have built in WP-CLI 1. Pantheon local dev - https://pantheon.io/docs/localdev 2. Lando - https://docs.lando.dev/config/wordpress.html#connecting-to- your-database 3. Localbyflywheel - https://localbyflywheel.com/
  14. 14. SSH in Docker Container ● SSH in docker container: docker exec -it [container-id] /bin/bash Ex. docker exec -it 7e4ad3a2558c /bin/bash
  15. 15. SSH in Lando Container ● SSH in Lando Container Ex. lando ssh
  16. 16. WP-CLI Demo
  17. 17. Updating WP-CLI $ wp cli update
  18. 18. Download WP Core $ wp core download
  19. 19. Generate wp-config.php file $ wp config create --dbname=mydb --dbuser=wp --dbpass=mypass
  20. 20. wp plugin <command> Manages plugins, including installs, activations, and updates.
  21. 21. Installing and activating plugin $ wp plugin install <plugin-name> [--activate]
  22. 22. Updating plugin $ wp plugin update <plugin-name>
  23. 23. Activate plugin $ wp plugin activate <plugin-name>
  24. 24. Deactivate plugin $ wp plugin deactivate <plugin-name>
  25. 25. List plugins $ wp plugin list
  26. 26. wp theme <command> Manages themes, including installs, activations, and updates.
  27. 27. Install and activate WordPress theme $ wp theme install <theme> --activate
  28. 28. Get details of an installed theme Get details of an installed theme
  29. 29. Get status of theme $ wp theme status catch-starter
  30. 30. wp user <command> Manages users, along with their roles, capabilities, and meta.
  31. 31. List users $ wp user list [--role=administrator,editor]
  32. 32. Create user $ wp user create roald roald@pantheon.io --role=administrator
  33. 33. Update user password $ wp user update user@example.com --user_pass=new-password
  34. 34. Delete user $ wp user delete roald [--reassign=carl]
  35. 35. Flushes the WP Object Cache object $ wp cache flush
  36. 36. wp cron <command> Tests, runs, and deletes WP-Cron events; manages WP-Cron schedules.
  37. 37. Cron Subcommands Name Description wp cron event Schedules, runs, and deletes WP-Cron events. wp cron schedule Gets WP-Cron schedules. wp cron test Tests the WP Cron spawning system and reports back its status.
  38. 38. Run all cron events due right now $ wp cron event run --due-now
  39. 39. Schedule a new cron event $ wp cron event schedule cron_test
  40. 40. Schedule a new cron event $ wp cron event schedule cron_test now hourly
  41. 41. Delete the next scheduled cron event $ wp cron event delete cron_test
  42. 42. List scheduled cron events in JSON $ wp cron event list --fields=hook,next_run --format=json
  43. 43. Test WP Cron spawning system $ wp cron test
  44. 44. Exports WordPress content to a WXR file Browser
  45. 45. Exports WordPress content to a WXR file $ wp export --dir=wp-content/uploads --user=roald --post_type=post --start_date=2019-08-01 --end_date=2019-08-30
  46. 46. Exports WordPress content to a WXR file Export post by ID $ wp export --dir=wp-content/uploads --post__in=51,70
  47. 47. Imports content from a given WXR file Browser
  48. 48. Imports content from a given WXR file Browser
  49. 49. Imports content from a given WXR file Browser
  50. 50. Imports content from a given WXR file Browser
  51. 51. Imports content from a given WXR file $ wp import wp-content/uploads/wpclidemo.wordpress.2019-08-18.000.xml --authors=create
  52. 52. Imports content from a given WXR file $ wp import wp-content/uploads/wpclidemo.wordpress.2019-08-18.000.xml --authors=create $ wp post list
  53. 53. Resources ● https://wp-cli.org/#installing ● https://pantheon.io/docs/terminus/ ● https://wp-cli.org/ ● https://developer.wordpress.org/cli/commands/
  54. 54. Follow me ● WordPress/@roaldu ● Drupal/@roaldumandal ● Github/@/umandalroald ● Twitter/@roaldart ● Instagram/@roaldphotography
  55. 55. The End Thank You!

×