saveDomDocument( DOMDocument $doc, string $filename )
Saves the XML document into a file
Parameters
- $doc
-
(DOMDocument) (Required)
- $filename
-
(string) (Required)
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 ); }
Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/savedomdocument