AnsPress_Cli::activate_addon( array $args, mixed $assoc_args )

Description #

Activate an addon.

OPTIONS

: Addon file name to activate. ## EXAMPLES wp anspress activate_addon free/avatar.php

Parameters #

  • $args
    array (Required) Arguments.
  • $assoc_args
    mixed (Required) Options.

Source #

File: lib/class-anspress-cli.php

	public function activate_addon( $args, $assoc_args ) {
		if ( empty( $args[0] ) ) {
			return WP_CLI::error( __( 'You must pass a addon name i.e. free/avatar.php', 'anspress-question-answer' ) );
		}

		$addon_name = $args[0];
		$ret        = ap_activate_addon( $args[0] );

		if ( false === $ret ) {
			return WP_CLI::error( __( 'Unable to activate addon. May be its already active or wrong name passed.', 'anspress-question-answer' ) );
		}

		WP_CLI::success( __( 'Successfully enabled addon', 'anspress-question-answer' ) );
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment