Automattic\WooCommerce\Internal\Admin\Notes
InstallJPAndWCSPlugins::install_and_activate_plugin
Installs and activates the specified plugin.
Метод класса: InstallJPAndWCSPlugins{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->install_and_activate_plugin( $plugin );
- $plugin(строка) (обязательный)
- The plugin slug.
Код InstallJPAndWCSPlugins::install_and_activate_plugin() InstallJPAndWCSPlugins::install and activate plugin WC 11.2.1
private function install_and_activate_plugin( $plugin ) {
$install_request = array( 'plugin' => $plugin );
$installer = new \Automattic\WooCommerce\Admin\API\OnboardingPlugins();
$result = $installer->install_plugin( $install_request );
// @todo Use the error statuses to decide whether or not to action the note.
if ( is_wp_error( $result ) ) {
return;
}
$activate_request = array( 'plugins' => $plugin );
$installer->activate_plugins( $activate_request );
}