Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating wordpress dump(.wxr) using unix and mysql

I need to create wordpress export dump (.WXR) using SSH on my server. I have lost access to the Wordpress dashboard.Can it be done using some unix,mysql script.

like image 598
Yahoo-Me Avatar asked Sep 08 '12 16:09

Yahoo-Me


1 Answers

As blogged here, all you need is the export_wp function, so run something along the lines of.

include 'wp-config.php';
include 'wp-admin/includes/export.php';

ob_start();
export_wp();
$file = ob_get_contents();
ob_end_clean();

$fh = fopen("wordpress-" . date('Y-m-d') . ".xml", 'w');
fwrite($fh, $file);
fclose($fh);

Then just grab the .xml file generated!

like image 60
csilk Avatar answered Sep 16 '22 20:09

csilk