How to modify admin headers
Not a direct answer, but: for simple data exports on the admin side, I generally just use the AJAX API. Set up an AJAX handler for your export: /** * export from admin */ function wpse_126508_export() { header(‘Content-Type: text/xml; charset=utf-8’); header(‘Content-Description: File Transfer’); header(‘Content-Disposition: attachment; filename=wpse_126508_export.xml’); $xml = new XMLWriter(); $xml->openURI(‘php://output’); $xml->startDocument(‘1.0’, ‘UTF-8’); $xml->startElement(‘wpse_126508_export’); // … Read more