function redirect_based_on_device() { $user_agent = $_SERVER['HTTP_USER_AGENT']; if (stripos($user_agent, 'iPhone') !== false || stripos($user_agent, 'iPad') !== false) { wp_redirect('https://apps.apple.com/id1659088177'); // Ссылка на App Store exit; } elseif (stripos($user_agent, 'Android') !== false) { wp_redirect('https://play.google.com/store/apps/details?id=com.feelweel.astro'); // Ссылка на Google Play exit; } else { wp_redirect('https://astroscope-app.com'); // fallback exit; } } add_action('template_redirect', 'redirect_based_on_device');