Last active
October 15, 2022 09:37
-
-
Save Oscar-Abad-Folgueira/9e79e35e4654f040aab087c6a11a0e8c to your computer and use it in GitHub Desktop.
WooCommerce Snippet: Comprobar si WooCommerce está activado.
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 | |
/** | |
* @snippet WooCommerce Snippet: Comprobar si WooCommerce está activado. | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://oscarabadfolgueira.com/woocommerce-snippet-comprobar-si-woocommerce-esta-activado/ | |
*/ | |
// Comprobar si WooCommerce está en el array de plugins ativos | |
if ( in_array( | |
'woocommerce/woocommerce.php', | |
apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) | |
) | |
) { | |
echo "Bien! WooCommerce está activo. Gracias, majo!"; | |
} else { | |
echo "Venga, activa WooCommerce o lo hago yo!"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment