Created
March 2, 2017 21:06
-
-
Save webaware/7d04f336633a3d150ded8501c2a32b4e to your computer and use it in GitHub Desktop.
Demonstrate a WooCommerce extension that doesn't catch the `woocommerce_loaded` hook because it fires before the extension had loaded
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: Yams for Woo | |
Description: A plugin that loads after WooCommerce, so it misses the woocommerce_loaded action | |
Version: 1 | |
Author: WebAware | |
Author URI: https://shop.webaware.com.au/ | |
*/ | |
error_log(basename(__FILE__)); | |
error_log("active non-mu plugins =\n" . print_r(wp_get_active_and_valid_plugins(),1)); | |
add_action('plugins_loaded', function() { | |
error_log(basename(__FILE__) . " plugins_loaded"); | |
}); | |
add_action('woocommerce_loaded', function() { | |
error_log(basename(__FILE__) . " woocommerce_loaded"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment