Seu problema é que ob_file
não é global. Você só define isso em c3m_export_xml()
. A configuração de global $ob_file
em ob_file_callback()
fornece um identificador de arquivo vazio. Tente isso:
function c3m_export_xml() {
$args=array(
'content' => 'posts',
'start_date' => 'october 2008',
'status' => 'published');
ob_start();
export_wp($args);
$xml = ob_get_clean();
file_put_contents('server_path_to_my_file.xml', $xml);
}