public function toggle( $args, $assoc_args = array() ) {
		$network_wide = Utils\get_flag_value( $assoc_args, 'network' );

		$successes = 0;
		$errors    = 0;
		$plugins   = $this->fetcher->get_many( $args );
		if ( count( $plugins ) < count( $args ) ) {
			$errors = count( $args ) - count( $plugins );
		}
		$this->chained_command = true;
		foreach ( $plugins as $plugin ) {
			if ( $this->check_active( $plugin->file, $network_wide ) ) {
				$this->deactivate( array( $plugin->name ), $assoc_args );
			} else {
				$this->activate( array( $plugin->name ), $assoc_args );
			}
			$successes++;
		}
		$this->chained_command = false;
		Utils\report_batch_operation_results( 'plugin', 'toggle', count( $args ), $successes, $errors );
	}
public function toggle( $args, $assoc_args = array() ) {
		$network_wide = Utils\get_flag_value( $assoc_args, 'network' );

		$successes = 0;
		$errors    = 0;
		$plugins   = $this->fetcher->get_many( $args );
		if ( count( $plugins ) < count( $args ) ) {
			$errors = count( $args ) - count( $plugins );
		}
		$this->chained_command = true;
		foreach ( $plugins as $plugin ) {
			if ( $this->check_active( $plugin->file, $network_wide ) ) {
				$this->deactivate( array( $plugin->name ), $assoc_args );
			} else {
				$this->activate( array( $plugin->name ), $assoc_args );
			}
			$successes++;
		}
		$this->chained_command = false;
		Utils\report_batch_operation_results( 'plugin', 'toggle', count( $args ), $successes, $errors );
	}
public function toggle ( $ args , $ assoc_args = array ( ) ) { $ network_wide = Utils \ get_flag_value ( $ assoc_args , 'network' ) ; $ successes = 0 ; $ errors = 0 ; $ plugins = $ this -> fetcher -> get_many ( $ args ) ; if ( count ( $ plugins ) < count ( $ args ) ) { $ errors = count ( $ args ) - count ( $ plugins ) ; } $ this -> chained_command = true ; foreach ( $ plugins as $ plugin ) { if ( $ this -> check_active ( $ plugin -> file , $ network_wide ) ) { $ this -> deactivate ( array ( $ plugin -> name ) , $ assoc_args ) ; } else { $ this -> activate ( array ( $ plugin -> name ) , $ assoc_args ) ; } $ successes ++ ; } $ this -> chained_command = false ; Utils \ report_batch_operation_results ( 'plugin' , 'toggle' , count ( $ args ) , $ successes , $ errors ) ; }
Toggles a plugin's activation state.

If the plugin is active, then it will be deactivated. If the plugin is
inactive, then it will be activated.

## OPTIONS

<plugin>...
: One or more plugins to toggle.

[--network]
: If set, the plugin will be toggled for the entire multisite network.

## EXAMPLES

# Akismet is currently activated
$ wp plugin toggle akismet
Plugin 'akismet' deactivated.
Success: Toggled 1 of 1 plugins.

# Akismet is currently deactivated
$ wp plugin toggle akismet
Plugin 'akismet' activated.
Success: Toggled 1 of 1 plugins.
Toggles a plugin s activation state .