In WordPress there’s a feature that exports your data into xml files. You can hit this URL with parameters and it will start downloading XML file. The cat parameter indicates the ID of the category containing posts you want to include in the XML file.
The problem is that I have over 200 categories and I want to export every category into separate file. So have to hit this url
http://www.domain.com/wp-admin/export.php?download=true&content=posts&cat=” + [category_num] + “&post_author=0&post_start_date=0&post_end_date=0&post_status=0
in FOR loop or something like this
for (i=1; i <= 200; i++) {
hit ("http://localhost/lyricsgroove/wp-admin/export.php?download=true&content=posts&cat="+i+"&post_author=0&post_start_date=0&post_end_date=0&post_ status=0");
}
You can try hitting your WP website /wp-admin/export.php?download=true&content=posts&cat=1&post_author=0&post_start_date=0&post_end_date=0&post_ status=0 and you’ll see XML downloading.
I need to do the same but in loop.
I tried doing this in PHP using file_get_contents and in jQuery using $.ajax but none of them starts download.
Warning: This way you try to open 200 new window and browsers will treat them as an unwanted popups. It’s not a correct way to export 200 file.
The best way may be to zip all files into one and then download one zipped file.