diff --git a/php/class-utils.php b/php/class-utils.php index d733479a..83c3282f 100644 --- a/php/class-utils.php +++ b/php/class-utils.php @@ -334,8 +334,17 @@ protected static function table_installed() { * Install our custom table. */ public static function install() { - // Ensure that the plugin bootstrap is loaded. - get_plugin_instance()->init(); + $plugin = get_plugin_instance(); + + // Ensure the plugin metadata (version, paths) is available for the DB + // routines below, but avoid re-running init during activation when it has + // already run on the `init` hook. Re-running the full bootstrap out of + // sequence during activation can destabilise plugin load order for the + // request (e.g. triggering other plugins such as ACF to initialise too + // early). We only need the plugin version here, not the component graph. + if ( empty( $plugin->version ) ) { + $plugin->init(); + } $sql = self::get_table_sql();