wp-cli/wp-cli#4818 introduces a "cli_init" hook during the Runner startup process that allows developers to register their custom commands by hooking into a specific event instead of checking for the definition and existence of the WP_CLI constant.
Developers can continue to check in the traditional way, but in order to communicate the existence of this hook to the broader community, we will need to update WP-CLI documentation to present examples on how this hook may be used. This includes:
Per Alain, "the WP_CLI constant example should stay, though. Using the cli_init hook is an alternative, not a replacement, depending on what your needs are."
wp-cli/wp-cli#4818 introduces a "cli_init" hook during the Runner startup process that allows developers to register their custom commands by hooking into a specific event instead of checking for the definition and existence of the WP_CLI constant.
Developers can continue to check in the traditional way, but in order to communicate the existence of this hook to the broader community, we will need to update WP-CLI documentation to present examples on how this hook may be used. This includes:
Per Alain, "the
WP_CLIconstant example should stay, though. Using thecli_inithook is an alternative, not a replacement, depending on what your needs are."