Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Main::hooks()

Register WP_CLI hooks


Description Description

Loads all commands and sets up license and addon commands to be aborted if the LifterLMS Helper is not present.


Top ↑

Return Return

(void)


Top ↑

Source Source

File: libraries/lifterlms-cli/src/Main.php

	private function hooks() {

		\WP_CLI::add_hook( 'after_wp_load', array( $this, 'commands' ) );

		// If the Helper doesn't exist abort command addition.
		if ( ! class_exists( 'LifterLMS_Helper' ) ) {
			$helper_commands = array(
				'license',
				'addon install',
				'addon uninstall',
				'addon activate',
				'addon deactivate',
				'addon update',
			);
			foreach ( $helper_commands as $command ) {
				\WP_CLI::add_hook(
					"before_add_command:llms {$command}",
					function( CommandAddition $command_addition ) {
						$command_addition->abort( 'The LifterLMS Helper is required to use this command.' );
					}
				);
			}
		}

	}

Top ↑

Changelog Changelog

Changelog
Version Description
0.0.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.