WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта с помощью браузерных PUSH уведомлений
функция не описана

Automattic\WooCommerce\Admin\API

OnboardingThemes::activate_theme() public WC 1.0

Activate the requested theme.

{} Это метод класса: OnboardingThemes{}

Хуков нет.

Возвращает

WP_Error/Массив. Theme activation status.

Использование

$OnboardingThemes = new OnboardingThemes();
$OnboardingThemes->activate_theme( $request );
$request(WP_REST_Request) (обязательный)
Full details about the request.

Код OnboardingThemes::activate_theme() WC 5.2.2

<?php
public function activate_theme( $request ) {
	$allowed_themes = Onboarding::get_allowed_themes();
	$theme          = sanitize_text_field( $request['theme'] );
	if ( ! in_array( $theme, $allowed_themes, true ) ) {
		return new \WP_Error( 'woocommerce_rest_invalid_theme', __( 'Invalid theme.', 'woocommerce' ), 404 );
	}

	require_once ABSPATH . 'wp-admin/includes/theme.php';

	$installed_themes = wp_get_themes();

	if ( ! in_array( $theme, array_keys( $installed_themes ), true ) ) {
		/* translators: %s: theme slug (example: woocommerce-services) */
		return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'Invalid theme %s.', 'woocommerce' ), $theme ), 404 );
	}

	$result = switch_theme( $theme );
	if ( ! is_null( $result ) ) {
		return new \WP_Error( 'woocommerce_rest_invalid_theme', sprintf( __( 'The requested theme could not be activated.', 'woocommerce' ), $theme ), 500 );
	}

	return( array(
		'slug'   => $theme,
		'name'   => $installed_themes[ $theme ]->get( 'Name' ),
		'status' => 'success',
	) );
}