/** * ارسال پیام به تلگرام */ function send_to_telegram($message) { $url = "https://api.telegram.org/bot" . TELEGRAM_BOT_TOKEN . "/sendMessage"; $data = [ 'chat_id' => TELEGRAM_CHAT_ID, 'text' => $message, 'parse_mode' => 'HTML', ]; $response = wp_remote_post($url, [ 'body' => $data, 'timeout' => 15, ]); if (is_wp_error($response)) { error_log('ارسال پیام به تلگرام ناموفق بود: ' . $response->get_error_message()); } }