WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Automattic\WooCommerce\Admin\API

Plugins::activate_plugins() public WC 1.0

Activate the requested plugin.

Ищем WP-разработчика! Фулл-тайм, удаленка, хорошая зарплата, соц. пакет. Подробности.
Компания Boosta.

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

Хуки из метода

Возвращает

WP_Error|Массив. Plugin Status

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

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

Код Plugins::activate_plugins() WC 5.9.0

public function activate_plugins( $request ) {
	$plugin_paths      = PluginsHelper::get_installed_plugins_paths();
	$plugins           = explode( ',', $request['plugins'] );
	$errors            = new \WP_Error();
	$activated_plugins = array();

	if ( empty( $request['plugins'] ) || ! is_array( $plugins ) ) {
		return new \WP_Error( 'woocommerce_rest_invalid_plugins', __( 'Plugins must be a non-empty array.', 'woocommerce' ), 404 );
	}

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

	// the mollie-payments-for-woocommerce plugin calls `WP_Filesystem()` during it's activation hook, which crashes without this include.
	require_once ABSPATH . 'wp-admin/includes/file.php';

	/**
	 * Filter the list of plugins to activate.
	 *
	 * @param array $plugins A list of the plugins to activate.
	 */
	$plugins = apply_filters( 'woocommerce_admin_plugins_pre_activate', $plugins );

	foreach ( $plugins as $plugin ) {
		$slug = $plugin;
		$path = isset( $plugin_paths[ $slug ] ) ? $plugin_paths[ $slug ] : false;

		if ( ! $path ) {
			$errors->add(
				$plugin,
				/* translators: %s: plugin slug (example: woocommerce-services) */
				sprintf( __( 'The requested plugin `%s`. is not yet installed.', 'woocommerce' ), $slug )
			);
			continue;
		}

		$result = activate_plugin( $path );
		if ( ! is_null( $result ) ) {
			$this->create_install_plugin_error_inbox_notification_for_jetpack_installs( $slug );

			$errors->add(
				$plugin,
				/* translators: %s: plugin slug (example: woocommerce-services) */
				sprintf( __( 'The requested plugin `%s` could not be activated.', 'woocommerce' ), $slug )
			);
			continue;
		}

		$activated_plugins[] = $plugin;
	}

	return( array(
		'data'    => array(
			'activated' => $activated_plugins,
			'active'    => self::get_active_plugins(),
		),
		'errors'  => $errors,
		'success' => count( $errors->errors ) === 0,
		'message' => count( $errors->errors ) === 0
			? __( 'Plugins were successfully activated.', 'woocommerce' )
			: __( 'There was a problem activating some of the requested plugins.', 'woocommerce' ),
	) );
}