From d115480f475684012320a16dd641a99c1b9a21ef Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Wed, 19 Sep 2018 17:44:21 -0400 Subject: [PATCH] Run migrations on every load --- inc/init.php | 5 ++++- pterotype.php | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/inc/init.php b/inc/init.php index b78dc34..70e1e81 100644 --- a/inc/init.php +++ b/inc/init.php @@ -15,7 +15,10 @@ add_action( 'user_register', function( $user_id ) { } ); add_action( 'pterotype_init', function() { - \migrations\run_migrations(); \actors\initialize_user_actors(); } ); + +add_action( 'pterotype_load', function() { + \migrations\run_migrations(); +} ); ?> diff --git a/pterotype.php b/pterotype.php index b0b9e87..93a10f1 100644 --- a/pterotype.php +++ b/pterotype.php @@ -7,9 +7,10 @@ require_once plugin_dir_path( __FILE__ ) . 'inc/init.php'; define( 'PTEROTYPE_VERSION', '0.0.1' ); function pterotype_init() { - update_option( 'pterotype_version', PTEROTYPE_VERSION ); do_action( 'pterotype_init' ); } +do_action( 'pterotype_load' ); + register_activation_hook( __FILE__, 'pterotype_init'); ?>