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.

Related posts

Leave a Reply

1 comment

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