Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
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. –  tbuteler 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

1 Answer 1

up vote 2 down vote accepted

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"
?>
share|improve this answer
    
This gives me a 502 error on my WP Engine site. Any suggestions? –  jnthnclrk Oct 29 '13 at 20:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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