Created
February 9, 2023 23:55
-
-
Save seb86/6ba97ea1e6fb09fb3e4bc9f9269c3f38 to your computer and use it in GitHub Desktop.
Initializes WooCommerce Admin only in the backend.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WooCommerce Admin | |
* Description: Initializes WooCommerce Admin only in the backend. | |
* Version: 0.0.1 | |
*/ | |
add_action( 'plugins_loaded', function() { | |
if ( is_admin() ) { | |
\Automattic\WooCommerce\Admin\Composer\Package::init(); | |
$activated_plugin = get_transient( 'woocommerce_activated_plugin' ); | |
if ( $activated_plugin ) { | |
delete_transient( 'woocommerce_activated_plugin' ); | |
/** | |
* WooCommerce is activated hook. | |
* | |
* @since 5.0.0 | |
* @param bool $activated_plugin Activated plugin path, | |
* generally woocommerce/woocommerce.php. | |
*/ | |
do_action( 'woocommerce_activated_plugin', $activated_plugin ); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment