wpseek.com
A WordPress-centric search engine for devs and theme authors



savedomdocument › WordPress Function

Since2.8.0
Deprecatedn/a
savedomdocument ( $doc, $filename )
Parameters: (2)
  • (DOMDocument) $doc
    Required: Yes
  • (string) $filename
    Required: Yes
Defined at:
Codex:

Saves the XML document into a file.



Source

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