How can I get an XML export of my 1K+ posts WordPress instance?

I’d like to export my database to XML because the import script to my new blog already supports getting data from that. A database backup or wordpress clone is not that useful in this case. The problem is that using the builtin export button times out after 90 seconds. I have ssh access to the server and am not afraid to use it 🙂

I don’t really know php but I can muddle around with help. Given Problem: Create a cron job to export posts to a WordPress XML file on server I think that the export_wp function might be what I want, I just don’t know what to do with that…

Related posts

Leave a Reply

1 comment

  1. You guys give up too easily 🙂

    This worked for me:

    <?php
    require(dirname(dirname(__FILE__)) . '/wp-load.php');
    require(ABSPATH . 'wp-admin/includes/admin.php');
    require('includes/export.php');
    
    ob_start();
    export_wp();
    $xml = ob_get_clean();
    
    file_put_contents('out.xml', $xml);
    echo "done"
    ?>