Run dbdelta on init, at least as long as this is a separate plugin

This commit is contained in:
Allen Snook 2018-10-31 15:47:39 -07:00
parent 0f45a08f20
commit 3c323d6c75
1 changed files with 10 additions and 0 deletions

View File

@ -92,6 +92,16 @@ function deactivate_wc_admin_plugin() {
}
register_deactivation_hook( WC_ADMIN_PLUGIN_FILE, 'deactivate_wc_admin_plugin' );
/**
* Update the database tables if needed. This hooked function does NOT need to
* be ported to WooCommerce's code base - WC_Install will do this on plugin
* update automatically.
*/
function wc_admin_init() {
WC_Admin_Api_Init::create_db_tables();
}
add_action( 'init', 'wc_admin_init' );
/**
* Set up the plugin, only if we can detect both Gutenberg and WooCommerce
*/