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 blog posts to plain text files so I can version control and update them using emacs org-mode via the org2blog package. However, I'm unfamiliar with SQL and the wordpress database structure. I'm hoping to get ideas for a SQL script to export my posts where each post is stored to a file named "YYYY-MM-DD_Title-of-post.org" and where the files will look like:

#+POSTID: 1071
#+DATE: [2011-09-21 Wed 18:00]
#+OPTIONS: toc:nil num:nil todo:nil pri:nil tags:nil ^:nil TeX:nil 
#+CATEGORY: cat1, cat2, cat3
#+TAGS: tag1, tag2, tag3
#+DESCRIPTION: 
#+TITLE: Hello World
### URL: http://...

BODY OF POST

The parts to be filled in is the DATE field, CATEGORY, TAGS, TITLE, URL, and BODY OF POST.

I think it might be asking too much to have someone do all my work for me. So, alternatively, I'd be content with a SQL script that outputs those fields in a delimited file, say delimited by "|||" so I can write a script elsewhere to get what I want.

Thanks for your help. Much appreciated!

share|improve this question

2 Answers 2

The WordPress plugin repository has several "export to CSV" plugins available. For example this one looks interesting. Its also a good startpoint if you don't want to use a plugin and code this on your own.

share|improve this answer
up vote 0 down vote accepted

I ended up exporting my posts to xml (an option in wordpress) and using the org2blog-importer tool that was just created by the author of org2blog to get the files into the format I wanted.

share|improve this answer

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.