Skip to content

Instantly share code, notes, and snippets.

@kwcjr
Created October 17, 2021 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwcjr/01f3ba3c187bb112cb5ef30282688613 to your computer and use it in GitHub Desktop.
Save kwcjr/01f3ba3c187bb112cb5ef30282688613 to your computer and use it in GitHub Desktop.
Woocommerce admin notices
function my_woocommerce_admin_notices()
{
// Test to see if WooCommerce is active (including network activated).
$plugin_path = trailingslashit( WP_PLUGIN_DIR ) . 'woocommerce/woocommerce.php';
if (
in_array( $plugin_path, wp_get_active_and_valid_plugins() )
|| in_array( $plugin_path, wp_get_active_network_plugins() )
) {
do_action( 'admin_notices' );
}
}
do_action( 'woocommerce_init', 'my_woocommerce_admin_notices', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment