php/WP_CLI/Runner.php
public function action_setup_theme_wp_cli_skip_themes() {
		$wp_cli_filter_active_theme = function( $value ) {
			$skipped_themes = WP_CLI::get_runner()->config['skip-themes'];
			if ( true === $skipped_themes ) {
				return '';
			}
			if ( ! is_array( $skipped_themes ) ) {
				$skipped_themes = explode( ',', $skipped_themes );
			}

			$checked_value = $value;
			// Always check against the stylesheet value
			// This ensures a child theme can be skipped when template differs
			if ( false !== stripos( current_filter(), 'option_template' ) ) {
				$checked_value = get_option( 'stylesheet' );
			}

			if ( '' === $checked_value || in_array( $checked_value, $skipped_themes, true ) ) {
				return '';
			}
			return $value;
		};
		$hooks                      = array(
			'pre_option_template',
			'option_template',
			'pre_option_stylesheet',
			'option_stylesheet',
		);
		foreach ( $hooks as $hook ) {
			add_filter( $hook, $wp_cli_filter_active_theme, 999 );
		}
		// Clean up after the TEMPLATEPATH and STYLESHEETPATH constants are defined
		WP_CLI::add_wp_hook(
			'after_setup_theme',
			function() use ( $hooks, $wp_cli_filter_active_theme ) {
				foreach ( $hooks as $hook ) {
					remove_filter( $hook, $wp_cli_filter_active_theme, 999 );
				}
			},
			0
		);
	}
public function action_setup_theme_wp_cli_skip_themes() {
		$wp_cli_filter_active_theme = function( $value ) {
			$skipped_themes = WP_CLI::get_runner()->config['skip-themes'];
			if ( true === $skipped_themes ) {
				return '';
			}
			if ( ! is_array( $skipped_themes ) ) {
				$skipped_themes = explode( ',', $skipped_themes );
			}

			$checked_value = $value;
			// Always check against the stylesheet value
			// This ensures a child theme can be skipped when template differs
			if ( false !== stripos( current_filter(), 'option_template' ) ) {
				$checked_value = get_option( 'stylesheet' );
			}

			if ( '' === $checked_value || in_array( $checked_value, $skipped_themes, true ) ) {
				return '';
			}
			return $value;
		};
		$hooks                      = array(
			'pre_option_template',
			'option_template',
			'pre_option_stylesheet',
			'option_stylesheet',
		);
		foreach ( $hooks as $hook ) {
			add_filter( $hook, $wp_cli_filter_active_theme, 999 );
		}
		// Clean up after the TEMPLATEPATH and STYLESHEETPATH constants are defined
		WP_CLI::add_wp_hook(
			'after_setup_theme',
			function() use ( $hooks, $wp_cli_filter_active_theme ) {
				foreach ( $hooks as $hook ) {
					remove_filter( $hook, $wp_cli_filter_active_theme, 999 );
				}
			},
			0
		);
	}
public function action_setup_theme_wp_cli_skip_themes ( ) { $ wp_cli_filter_active_theme = function ( $ value ) { $ skipped_themes = WP_CLI :: get_runner ( ) -> config [ 'skip-themes' ] ; if ( true === $ skipped_themes ) { return '' ; } if ( ! is_array ( $ skipped_themes ) ) { $ skipped_themes = explode ( ',' , $ skipped_themes ) ; } $ checked_value = $ value ; // Always check against the stylesheet value // This ensures a child theme can be skipped when template differs if ( false !== stripos ( current_filter ( ) , 'option_template' ) ) { $ checked_value = get_option ( 'stylesheet' ) ; } if ( '' === $ checked_value || in_array ( $ checked_value , $ skipped_themes , true ) ) { return '' ; } return $ value ; } ; $ hooks = array ( 'pre_option_template' , 'option_template' , 'pre_option_stylesheet' , 'option_stylesheet' , ) ; foreach ( $ hooks as $ hook ) { add_filter ( $ hook , $ wp_cli_filter_active_theme , 999 ) ; } // Clean up after the TEMPLATEPATH and STYLESHEETPATH constants are defined WP_CLI :: add_wp_hook ( 'after_setup_theme' , function ( ) use ( $ hooks , $ wp_cli_filter_active_theme ) { foreach ( $ hooks as $ hook ) { remove_filter ( $ hook , $ wp_cli_filter_active_theme , 999 ) ; } } , 0 ) ; }
Set up the filters to skip the loaded theme
Set up the filters to skip the loaded theme