WordPress at Your Fingertips
function is not described

saveDomDocument() WP 2.8.0

Saves the XML document into a file

No Hooks.

Return

null. Nothing.

Usage

saveDomDocument( $doc, $filename ) // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid;
$doc(DOMDocument) (required)
-
$filename(string) (required)
-

Changelog

Since 2.8.0 Introduced.

Code of saveDomDocument() WP 5.8.2

function saveDomDocument( $doc, $filename ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
	$config = $doc->saveXML();
	$config = preg_replace( "/([^\r])\n/", "$1\r\n", $config );
	$fp     = fopen( $filename, 'w' );
	fwrite( $fp, $config );
	fclose( $fp );
}