diff --git a/lib/wpforms.php b/lib/wpforms.php index e0bb3d12..68df1260 100644 --- a/lib/wpforms.php +++ b/lib/wpforms.php @@ -24,6 +24,18 @@ function studiopress_maybe_create_wpforms_form() { // phpcs:ignore -- studiopres return; } + // Form creation requires WPForms 1.5.2 or higher. + // If the site already as an earlier version of the plugin installed, don't create a form. + // Plugins do not get upgraded during one-click theme setup. + if ( function_exists( 'get_plugins' ) ) { + $plugin_data = get_plugins(); + $wpforms_lite_version = isset( $plugin_data['wpforms-lite/wpforms.php']['Version'] ) ? $plugin_data['wpforms-lite/wpforms.php']['Version'] : ''; + + if ( version_compare( $wpforms_lite_version, '1.5.2', '<' ) ) { + return; + } + } + $existing_form_id = get_option( 'genesis_onboarding_wpforms_id' ); if ( $existing_form_id ) {