OpenPLUTO

Migrating Over 3,000 WordPress Posts to BearBlog with Python

If you've ever exported a WordPress site and ended up with a folder full of markdown files, you know the feeling: the content is there, but it's not quite ready for anywhere else. The metadata is in the wrong shape, the image links are all broken, and the idea of fixing things post by post is enough to make you close the laptop and walk away.

For the past several months, I've been doing this process manually of editing each file and putting them up as I completed each of them.

Then I got the idea of asking Claude Code if it could help me automate this process somehow. Enter Python. :🐍 The script it created was built to solve exactly that problem at scale. In my case, over 3,000 posts spanning nearly 20 years.

What it does

The script takes a folder of WordPress-exported markdown files and batch-converts them into notes that are ready for both Obsidian Publish and BearBlog.

For each file it:

🤖 PLEASE BE ADVISED CLAUDE WROTE THESE BULLET POINTS BECAUSE I HAVE A VERY POOR UNDERSTANDING OF PYTHON.

How it looks in practice on Linux Mint

The script runs from the command line (Terminator or Ghostty for me) and takes a single folder path as its argument:

python3 wp_to_bearblog.py /path/to/your/posts/2012/07

It processes every .md file in that folder in place and is designed to be run one month at a time, which maps naturally to how WordPress structures its export folders.

If you've got a dusty WordPress export sitting on a hard drive somewhere, hopefully this gives you a nudge to dig it out. Old writing deserves a second life. ■

#bear #claude #wordpress