diff --git a/admin/admin-install.php b/admin/admin-install.php index 34ef328916d..23f20da8e4d 100644 --- a/admin/admin-install.php +++ b/admin/admin-install.php @@ -9,6 +9,13 @@ * @package WooCommerce */ +/** + * Queue install when activated + */ +function queue_install_woocommerce() { + add_action('init', 'install_woocommerce', 0); +} + /** * Install woocommerce * @@ -17,8 +24,7 @@ function install_woocommerce() { global $woocommerce; - $woocommerce = &new woocommerce(); - + // Define post types before we start woocommerce_post_type(); diff --git a/woocommerce.php b/woocommerce.php index ba017ac46b0..a1b3a4385e1 100644 --- a/woocommerce.php +++ b/woocommerce.php @@ -50,9 +50,9 @@ if (is_admin()) : /** * Installs and upgrades **/ - register_activation_hook( __FILE__, 'install_woocommerce' ); + register_activation_hook( __FILE__, 'queue_install_woocommerce' ); - if (get_site_option('woocommerce_db_version') != WOOCOMMERCE_VERSION) add_action('init', 'install_woocommerce'); + if (get_site_option('woocommerce_db_version') != WOOCOMMERCE_VERSION) add_action('init', 'install_woocommerce', 0); endif;