insights()->init(); // The legacy procedural inc/* code has been fully removed — the new React + REST architecture // (bootstrap.php) now provides every feature: settings, the AI Assistant + editor integrations // (Classic/Gutenberg/Elementor), generation, templates, WooCommerce, bulk and white-label. // Signal readiness — the Pro plugin waits on this (did_action('wpwand_init')) before booting. do_action('wpwand_init'); } add_action('plugins_loaded', 'wpwand_init', 10); function wpwand_pro_version_check() { if (!is_admin()) { return; } if (isset($_GET['force-check']) && check_admin_referer('wpwand_pro_force_update_check')) { wp_clean_plugins_cache(); wp_update_plugins(); wp_safe_redirect(admin_url('plugins.php')); exit; } // Determine the installed Pro version straight from its header (works even when the // legacy Pro build never defined a version constant), and require a 2.0.0+ match. $pro_file = WP_PLUGIN_DIR . '/wp-wand-pro/wp-wand-pro.php'; if (!file_exists($pro_file)) { return; } if (!function_exists('get_plugin_data')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $pro_version = get_plugin_data($pro_file, false, false)['Version']; if ($pro_version && version_compare($pro_version, '2.0.0', '<')) { add_action('admin_notices', function () { $force_update_url = wp_nonce_url(admin_url('admin.php?page=wpwand&force-check=1'), 'wpwand_pro_force_update_check'); echo '

'; printf( /* translators: %s: URL to trigger a plugin update check */ wp_kses(__('Action required: WP Wand Pro must be updated to version 2.0.0 or higher to match WP Wand 2.0.0. Your Pro features are paused until the update completes. Update now', 'wp-wand'), ['a' => ['href' => []], 'strong' => []]), esc_url($force_update_url) ); echo '

'; }); } } add_action('init', 'wpwand_pro_version_check'); // Hook into the 'admin_init' action add_action('admin_init', 'wpwand_activation_redirect'); // Activation redirect function function wpwand_activation_redirect() { if (get_option('wpwand_activation_redirect', false)) { // Redirect to a specific page or URL after activation delete_option('wpwand_activation_redirect'); // New React welcome screen (replaces the legacy ?welcome_screen page). wp_safe_redirect(admin_url('admin.php?page=wpwand-welcome')); exit; } } // Hook into the 'activated_plugin' action — show the welcome screen on first activation. add_action('activated_plugin', 'wpwand_set_activation_redirect'); // Set activation redirect flag function wpwand_set_activation_redirect($plugin) { if ($plugin === plugin_basename(__FILE__)) { // Set the option to redirect after activation update_option('wpwand_activation_redirect', true); } } // write a wpwand_php_version_notice function function wpwand_php_version_notice() { echo '

' . esc_html__('WP Wand requires PHP 7.4 or higher. Please upgrade your PHP version.', 'wp-wand') . '

'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped }