An introduction to WP CLI & custom commands

For WordPress developers, this session will be handy in understanding how to use WP-CLI along with writing your own custom commands.

We expect attendees to bring along their laptops. Charging points and table with chairs at the workshop room have been arranged.

  • Intro: short overview on topic and getting people ready
  • Local dev: setup development env (local by flywheel or any other suggestion)
  • Handbook: quick walkthrough of official docs and how to navigate and use
  • Anatomy of a command: overview on cli command structure when running commands (using core commands)
  • Setting up plugin: getting base ready to use for command handson
  • Writing custom commands (function/closure)
    • check for WP CLI and load command conditionally
    • basic command to get started
  • Command response design for feedback
    • msg/notice to be displayed from command via following internal helpers
      • line
      • info
      • warning
      • error
      • error_multi_line
      • success
    • colorize
    • Progress bar for working with large data set
  • Command arguments
    • positional arguments
    • flags
  • class based command
    • registering command
    • supporting subcommands
    • Add helper/internal functions
  • Command help documentation
  • Conclusion/Resource sharing

Categories:

Tracks: