wxr_cdata() WordPress Function
The wxr_cdata() function is used to escape data for use in a WordPress XML file. It is used to wrap data in a CDATA section so that it will not be read by XML parsers as markup.
wxr_cdata( string $str ) #
Wrap given string in XML CDATA tag.
Parameters
- $str
(string)(Required)String to wrap in XML CDATA tag.
Return
(string)
Source
File: wp-admin/includes/export.php
function wxr_cdata( $str ) {
if ( ! seems_utf8( $str ) ) {
$str = utf8_encode( $str );
}
// $str = ent2ncr(esc_html($str));
$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
return $str;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 2.1.0 | Introduced. |