/** * Add hreflang tags for GTranslate subdomain languages * ExploreTraveler.com */ add_action( 'wp_head', 'exploretraveler_add_hreflang_tags', 1 ); function exploretraveler_add_hreflang_tags() { // Get the current path (without domain) $path = $_SERVER['REQUEST_URI']; // Clean the path (remove query strings if any) $path = strtok( $path, '?' ); // List of your languages (subdomain => hreflang code) $languages = array( 'en' => 'https://exploretraveler.com', // English (main) 'es' => 'https://es.exploretraveler.com', // Spanish 'ar' => 'https://ar.exploretraveler.com', // Arabic 'zh-CN' => 'https://zh-CN.exploretraveler.com', // Chinese Simplified 'zh-TW' => 'https://zh-TW.exploretraveler.com', // Chinese Traditional 'fr' => 'https://fr.exploretraveler.com', // French 'de' => 'https://de.exploretraveler.com', // German 'id' => 'https://id.exploretraveler.com', // Indonesian 'ja' => 'https://ja.exploretraveler.com', // Japanese 'ko' => 'https://ko.exploretraveler.com', // Korean 'ms' => 'https://ms.exploretraveler.com', // Malay 'ru' => 'https://ru.exploretraveler.com', // Russian 'uk' => 'https://uk.exploretraveler.com', // Ukrainian 'tl' => 'https://tl.exploretraveler.com', // Filipino ); // Output the tags foreach ( $languages as $code => $domain ) { $url = rtrim( $domain, '/' ) . $path; echo '' . "\n"; } // x-default points to the English version $default_url = 'https://exploretraveler.com' . $path; echo '' . "\n"; }
ExploreTraveler is an international travel and RV living knowledge platform built on real-world travel writing, photography, and video documentation. John and Karen Gentry have been traveling, researching, and documenting travel since 1989, with ExploreTraveler formally launched online in 2011.
Our content focuses on travel preparation, safety, logistics, destination research, and practical travel guidance across the United States and worldwide.