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.


Top ↑

Return

(string)


Top ↑

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;
	}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.