insights()->init(); // Include required files require_once WPWAND_PLUGIN_DIR . 'inc/config.php'; require_once WPWAND_PLUGIN_DIR . 'inc/editor.php'; require_once WPWAND_PLUGIN_DIR . 'inc/admin.php'; require_once WPWAND_PLUGIN_DIR . 'inc/data.php'; require_once WPWAND_PLUGIN_DIR . 'inc/helper-functions.php'; require_once WPWAND_PLUGIN_DIR . 'inc/frontend.php'; require_once WPWAND_PLUGIN_DIR . 'inc/api.php'; require_once WPWAND_PLUGIN_DIR . 'inc/WooCommerce.php'; if (!function_exists('wpwand_pro_init')) { require_once WPWAND_PLUGIN_DIR . 'inc/post-generator.php'; } $is_agency = wpwand_get_option('wpwand_pro_tala_agency'); if (!$is_agency) { require_once WPWAND_PLUGIN_DIR . 'inc/white-label.php'; } require_once WPWAND_PLUGIN_DIR . 'inc/gutenberg.php'; // Add Elementor initialization hook add_action('elementor/init', function() { require_once WPWAND_PLUGIN_DIR . 'inc/modules/elementor/wp-wand-elementor.php'; WDELMTR_Extension::instance(); }); do_action('wpwand_init'); } add_action('plugins_loaded', 'wpwand_init', 100); function wpwand_pro_version_check() { if (!defined('WPWAND_PRO_VERSION')) { return; } if (isset($_GET['force-check']) && check_admin_referer('wpwand_pro_force_update_check')) { wp_clean_plugins_cache(); wp_update_plugins(); wp_redirect(admin_url('plugins.php')); exit; } // Get pro version $pro_file = WP_PLUGIN_DIR . '/wp-wand-pro/wp-wand-pro.php'; if (file_exists($pro_file)) { $pro_data = get_plugin_data($pro_file); $pro_version = $pro_data['Version']; if (version_compare($pro_version, '1.2.3', '<')) { add_action('admin_notices', function() { $force_update_url = wp_nonce_url(admin_url('admin.php?page=wpwand-settings&force-check=1'), 'wpwand_pro_force_update_check'); echo '

' . sprintf( __('Please update WP Wand Pro to version 1.2.3 or higher for full compatibility. Update now', 'wp-wand'), $force_update_url ) . '

'; }); } } } 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'); wp_safe_redirect(admin_url('admin.php?page=wpwand&welcome_screen')); exit; } } // Hook into the 'activated_plugin' action // 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 }