the sitemap as an XML file
$fp = fopen(ABSPATH . ‘sitemap.xml’, ‘w’);
fwrite($fp, $sitemap->asXML());
fclose($fp);
?>
This code creates a new sitemap in XML format and saves it to the root directory of the WordPress site.
Was this code snippet helpful?
YesNo