Title: New <code>esc_xml()</code> function in WordPress 5.5
Author: Pascal Birchler
Published: July 21, 2020

---

 [  ](https://profiles.wordpress.org/swissspidy/) [Pascal Birchler](https://profiles.wordpress.org/swissspidy/)
2:30 pm _on_ July 21, 2020     
Tags: [5.5 ( 87 )](https://make.wordpress.org/core/tag/5-5/),
[dev-notes ( 647 )](https://make.wordpress.org/core/tag/dev-notes/), [sitemaps ( 15 )](https://make.wordpress.org/core/tag/sitemaps/),
[xml-sitemaps ( 15 )](https://make.wordpress.org/core/tag/xml-sitemaps/)   

# New `esc_xml()` function in WordPress 5.5

As part of the development for the new XML Sitemaps feature in WordPress 5.5, a 
new `esc_xml()` function has been added to coreCore Core is the set of software 
required to run WordPress. The Core Development Team builds WordPress. that filters
a string cleaned and escaped for output in XML. This joins the existing set of functions
like `esc_html()` and `esc_js()`.

While all contents in XML sitemaps are already escaped using this new function, 
existing code in WordPress core can be updated to leverage it in future releases.

`wp_kses_normalize_entities()` has been updated accordingly to support this, and
now can distinguish between HTMLHTML HyperText Markup Language. The semantic scripting
language primarily used for outputting content in web browsers. and XML context.

**Note:** l10nL10n Localization, or the act of translating code into one's own language.
Also see [internationalization](https://make.wordpress.org/core/2020/07/21/new-esc_xml-function-in-wordpress-5-5/?output_format=md#i18n).
Often written with an uppercase L so it is not confused with the capital letter 
i or the numeral 1. WordPress has a capable and dynamic group of polyglots who take
WordPress to more than 70 different locales. helpers like `esc_xml__()` and `esc_xml_e()`
are being proposed separately in [#50551](https://core.trac.wordpress.org/ticket/50551),
and are not part of this release.

[#5-5](https://make.wordpress.org/core/tag/5-5/), [#dev-notes](https://make.wordpress.org/core/tag/dev-notes/),
[#sitemaps](https://make.wordpress.org/core/tag/sitemaps/), [#xml-sitemaps](https://make.wordpress.org/core/tag/xml-sitemaps/)

### Share this:

 * [  Threads ](https://make.wordpress.org/core/2020/07/21/new-esc_xml-function-in-wordpress-5-5/?share=threads)
 * [  Mastodon ](https://make.wordpress.org/core/2020/07/21/new-esc_xml-function-in-wordpress-5-5/?share=mastodon)
 * [  Bluesky ](https://make.wordpress.org/core/2020/07/21/new-esc_xml-function-in-wordpress-5-5/?share=bluesky)
 * [  X ](https://make.wordpress.org/core/2020/07/21/new-esc_xml-function-in-wordpress-5-5/?share=x)
 * [  Facebook ](https://make.wordpress.org/core/2020/07/21/new-esc_xml-function-in-wordpress-5-5/?share=facebook)
 * [  LinkedIn ](https://make.wordpress.org/core/2020/07/21/new-esc_xml-function-in-wordpress-5-5/?share=linkedin)

 1. ![](https://secure.gravatar.com/avatar/7a36060ae08c0b5588810cd5e6ea430fe9b10ce7ca8debbe928a1e254e78b4d4?
    s=32&d=mm&r=g)
 2.  [Paul Biron](https://profiles.wordpress.org/pbiron/)  2:50 pm _on_ July 21, 2020
 3. In addition to converting HTMLHTML HyperText Markup Language. The semantic scripting
    language primarily used for outputting content in web browsers. [Named character references](https://www.w3.org/TR/html52/syntax.html#named-character-references)(
    that are not also defined in XML, like `&`) to their Unicode code points, `esc_xml()`
    almost ensures that [CDATA Sections](https://www.w3.org/TR/REC-xml/#sec-cdata-sect)
    are **NOT** escaped.

Comments are closed.

# Post navigation

[← Editor Chat Agenda: 22 July, 2020](https://make.wordpress.org/core/2020/07/21/editor-chat-agenda-22-july-2020/)

[Navigation sync notes →](https://make.wordpress.org/core/2020/07/22/navigation-sync-notes/)