wpsync - Markdown to WP

wpsync is a command-line tool to sync a local directory of markdown files to your WordPress.

I really like markdown and vim. My publishing process was:

  1. Create a draft in markdown,
  2. When ready to publish v1.0 copy-paste to WordPress; the editor converts markdown nicely, and then publish
  3. However, when a revision is needed, it must be done in WordPress not in my markdown/vim tools.

After publishing my Working with Vim tutorial, there was a lot of revisions and additions I needed to make, and I couldn't use vim. This seemed wrong writing a tutorial for vim, not in vim.

So I wrote the wpsync program which reads a directory of markdown files, and uses the WordPresss API to publish and update posts, pages, and media.

Here's a demo:

wpsync demo

Install and Setup

The program is written in Go, I probably should have written it in JavaScript so I could use some of the markdown libraries that WordPress uses, but this is a personal project and I like writing Golang. I even use wpsync to publish my Working with Go tutorial.

You can view the code and download binary releases at

Authentication on the command-line is the tricky bit. The JWT Authentication plugin is required and what makes it possible. For now this does not work for sites. For wpcom, it is possible to use a similar token for authentication, however I don't haven't setup a way to retrieve this token via the command-line.


Create a directory for your site, and sub-directories posts, media or pages. Any files in these directories will be uploaded.

Run wpsync --init for initial setup

Run wpsync -confirm to confirm each upload

See the readme in Github for full documentation.

Usage: wpsync [args]


        Confirm prompt before upload
        Display debug messages
        Test run, shows what will happen
        Display help and quit
        Create settings for blog and auth
        Do not display info messages
        Test config and authentication
        Display version and quit

Next Steps

I'll probably keep tweaking away on this, right now there is only one-way sync from local to remote. It would be nice to be able to pull down existing posts, edit, and publish.

Any feedback, comments, issues, or even pull requests are welcome.