Title: XML Language format
Last modified: December 22, 2025

---

# XML Language format

 *  Resolved [gnostis](https://wordpress.org/support/users/gnostis/)
 * (@gnostis)
 * [5 months, 2 weeks ago](https://wordpress.org/support/topic/xml-language-format/)
 * Google writes:
   The tag is the language of your publication. Use an ISO 639 language
   code (two or three letters).
 * Exception: For Simplified Chinese, use zh-cn and for Traditional Chinese, use
   zh-tw. ([https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap](https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap))
   
   Plagin code “echo esc_html(get_bloginfo(‘language’));” return not corected fomat,
   example “en-GB”.
    -  This topic was modified 5 months, 2 weeks ago by [gnostis](https://wordpress.org/support/users/gnostis/).

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Harshit Kumar](https://wordpress.org/support/users/kumarharshit/)
 * (@kumarharshit)
 * [5 months, 2 weeks ago](https://wordpress.org/support/topic/xml-language-format/#post-18764722)
 * Thanks for pointing this out 👍
 * You’re right — `get_bloginfo('language')` returns a locale format like `en-GB`,
   which does **not** comply with Google News sitemap requirements that expect an
   ISO 639 language code (e.g. `en`, `fr`, `hi`), except for `zh-cn` and `zh-tw`.
 * I’ll update the plugin to normalize the value by:
    - Converting the locale to lowercase
    - Extracting only the ISO 639 language part before the hyphen
    - Applying Google News exceptions for Chinese (`zh-cn`, `zh-tw`)
 * Example fix:
 * `$lang = strtolower( get_bloginfo('language') ); $lang = explode('-', $lang)[
   0];`
 * This should ensure the `<news:language>` tag is always valid according to Google’s
   News Sitemap guidelines.
 * Thanks again for the clarification and reference link.
 *  Thread Starter [gnostis](https://wordpress.org/support/users/gnostis/)
 * (@gnostis)
 * [5 months, 2 weeks ago](https://wordpress.org/support/topic/xml-language-format/#post-18764844)
 * Thank you for the decision.
   I made a local fork of your plugin, as I needed integration
   with other plugins.If I discover any other issues, I will certainly let you know.
 *  Plugin Author [Harshit Kumar](https://wordpress.org/support/users/kumarharshit/)
 * (@kumarharshit)
 * [5 months, 2 weeks ago](https://wordpress.org/support/topic/xml-language-format/#post-18765101)
 * Thanks for the update 👍
 * That makes sense — glad the plugin worked well enough for your integration needs.
   
   If you notice anything that could be improved or think a change might be useful
   for the core plugin, feel free to share it here.
 * Appreciate you taking the time to report back.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fxml-language-format%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/free-news-sitemap-generator-by-kumarharshit-in/assets/icon-
   128x128.png?rev=3352563)
 * [XML News Sitemap Generator](https://wordpress.org/plugins/free-news-sitemap-generator-by-kumarharshit-in/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/free-news-sitemap-generator-by-kumarharshit-in/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/free-news-sitemap-generator-by-kumarharshit-in/)
 * [Active Topics](https://wordpress.org/support/plugin/free-news-sitemap-generator-by-kumarharshit-in/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/free-news-sitemap-generator-by-kumarharshit-in/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/free-news-sitemap-generator-by-kumarharshit-in/reviews/)

## Tags

 * [sitemap](https://wordpress.org/support/topic-tag/sitemap/)

 * 5 replies
 * 2 participants
 * Last reply from: [Harshit Kumar](https://wordpress.org/support/users/kumarharshit/)
 * Last activity: [5 months, 2 weeks ago](https://wordpress.org/support/topic/xml-language-format/#post-18765101)
 * Status: resolved