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...

  • 2
    It would really be much easier to just configure PHP not to time out after 90 seconds. Or upgrade your db server to get the job done in 90 seconds. Depending on where you're hosting it, both things can be much easier than what you're proposing. – Tomas Buteler Mar 30 '13 at 21:13
  • Agreed with @tbuteler. If you have ssh access, reconfigure PHP and/or MySQL to have longer timeouts. – s_ha_dum Mar 30 '13 at 21:27

You guys give up too easily :)

This worked for me:

require(dirname(dirname(__FILE__)) . '/wp-load.php');
require(ABSPATH . 'wp-admin/includes/admin.php');

$xml = ob_get_clean();

file_put_contents('out.xml', $xml);
echo "done"
  • This gives me a 502 error on my WP Engine site. Any suggestions? – jnthnclrk Oct 29 '13 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.