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{}

No Hooks.

Return

null. Nothing.

Usage

$result = Loader::deactivate_wc_admin_plugin();

Код Loader::deactivate_wc_admin_plugin() WC 7.1.0

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__( 'The %1$s plugin has been deactivated as the latest improvements are now included with the %2$s plugin.', 'woocommerce' ),
					'<code>WooCommerce Admin</code>',
					'<code>WooCommerce</code>'
				);
				echo '</p></div>';
			}
		);
	}
}