I wish to export all of my posts as individual plain text files. So, the format may be something like:
title.txt
Title: title
Pub date: date
Category: cat
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
Is this possible? Is there a plugin or workaround to do this?
Thanks.
Try this (you may need to bootstrap WP by loading
wp-load.php
, depending on where you put this code).Keep in mind, if two posts have the same title, you’ll only get one text file.
A cursory search doesn’t turn up any plugins that do this … but you could use the built-in exporter as an example for building out your own plugin. It’s located in
/wp-admin/includes/export.php
.Essentially, it’s a PHP page that queries the database to get all of your posts, then dumps the content into a pre-build XML template that can be imported later.
It looks very much as if you wanted to switch to a static blog generator like Jekyll. The following answer is based on pdb’s answer and should be ready-to-use. My answer can deal with:
Here it is:
“Why not just work with the default XML export”
I don’t have an answer, but the OP might want to do this so he or she can import the posts into Devonthink Pro or a similar program.