saveDomDocument

Advertisement

Summery Summery

Saves the XML document into a file

Syntax Syntax

saveDomDocument( DOMDocument $doc, string $filename )

Parameters Parameters

$doc

(DOMDocument) (Required)

$filename

(string) (Required)

Source Source

File: wp-admin/includes/misc.php

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

Advertisement

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.