WC_CLI::hooks()
Sets up and hooks WP CLI to our CLI code.
Method of the class: WC_CLI{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->hooks();
WC_CLI::hooks() WC CLI::hooks code WC 9.4.2
private function hooks() { WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Runner::after_wp_load' ); WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Tool_Command::register_commands' ); WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Update_Command::register_commands' ); WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_Tracker_Command::register_commands' ); WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_COM_Command::register_commands' ); WP_CLI::add_hook( 'after_wp_load', 'WC_CLI_COM_Extension_Command::register_commands' ); $cli_runner = wc_get_container()->get( CustomOrdersTableCLIRunner::class ); WP_CLI::add_hook( 'after_wp_load', array( $cli_runner, 'register_commands' ) ); $cli_runner = wc_get_container()->get( ProductAttributesLookupCLIRunner::class ); WP_CLI::add_hook( 'after_wp_load', fn() => \WP_CLI::add_command( 'wc palt', $cli_runner ) ); if ( class_exists( \Automattic\WooCommerce\Blueprint\Cli::class ) ) { WP_CLI::add_hook( 'after_wp_load', 'Automattic\WooCommerce\Blueprint\Cli::register_commands' ); } }