saveDomDocument() WordPress Function
The saveDomDocument() function is used to save a DOM document to a WordPress database. This function can be used to save any DOM document, including an HTML document, XML document, or XHTML document.
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 ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |