Automattic\WooCommerce\Internal\Admin

Loader::deactivate_wc_admin_plugin()public staticWC 1.0

If WooCommerce Admin is installed and activated, it will attempt to deactivate and show a notice.

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

Хуков нет.

Возвращает

null. Ничего.

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

$result = Loader::deactivate_wc_admin_plugin();

Код Loader::deactivate_wc_admin_plugin() WC 6.6.1

public static function deactivate_wc_admin_plugin() {
	$plugin_path = PluginsHelper::get_plugin_path_from_slug( 'woocommerce-admin' );
	if ( is_plugin_active( $plugin_path ) ) {
		$path = PluginsHelper::get_plugin_path_from_slug( 'woocommerce-admin' );
		deactivate_plugins( $path );
		$notice_action = is_network_admin() ? 'network_admin_notices' : 'admin_notices';
		add_action(
			$notice_action,
			function() {
				echo '<div class="error"><p>';
				printf(
					/* translators: %s: is referring to the plugin's name. */
					esc_html__( '%1$s plugin has been deactivated to avoid conflicts with %2$s plugin.', 'woocommerce' ),
					'<code>WooCommerce Admin</code>',
					'<code>WooCommerce</code>'
				);
				echo '</p></div>';
			}
		);
	}
}