I Automated My Blog From Draft to WordPress Post With Claude Code

スポンサーリンク
I Automated My Blog From Draft to WordPress Post With Claude Code Automation
スポンサーリンク

My blog updates kept stalling, so I asked Claude Code for help

Honestly, this blog earns almost nothing, with updates getting rarer. I was even thinking of closing it. Before that, I decided to test how much of my own work Claude Code could take over, from coming up with topics to writing drafts to posting to WordPress. Claude Code may sound like an AI tool for software developers, but in practice it served as a sounding board for work, a researcher, even the one building the integrations. I think anyone can do the same without programming knowledge, giving instructions step by step, so here’s how I put it together.

Short answer: Claude Code writes drafts, then posts them to WordPress as drafts through the REST API with an application password; I review, edit, then press Publish myself. Having it read my past posts first is what made the drafts sound like me.

My very first prompt was about this rough (translated from Japanese):

“This is my blog site, but it isn’t making money, so I’m wondering whether to close it. Could you automate creating Claude-related posts using you, then put them on WordPress?”

Division of labor: drafts automatic, editing plus publishing manual

The first thing I decided was where Claude Code’s work ends, mine begins. Full automation from writing to publishing would be possible, but the risk of factual errors or low-quality content going out as is felt scary. Personally, I also lose interest in posts that are obviously raw AI output. So I set these rules:

  • Claude Code handles topic ideas, drafts, registering posts in WordPress
  • But posts always stop as drafts
  • Reviewing, editing, pressing Publish are always done by me

Deciding clearly at the start what to delegate versus what to keep for my own judgment paid off later. Along the way, limits came up, such as “posts can’t be deleted given how my WordPress API setup behaves”. But since I’d started on the premise that important operations stay with me, I could calmly say “then I’ll do that part by hand”.

No topics off the top of its head: verify, test, then post

When Claude Code helps with topics, I don’t have it write right away. I first talk about my work experience or problems, discussing together whether a topic is worth a post. Stating policies up front, like “don’t cover this, since every workplace does it differently” or “frame it as solving a real-world pain point”, made later topic ideas much sharper. It feels about the same as a meeting between people.

Once a topic is chosen, I have it verify the facts by web search. My tech posts often deal with numbers or rules, so it checks primary sources (official blogs, standards bodies’ announcements) then leaves them as reference links at the end. Compared with searching each item myself, this may be where I save the most time.

I also test not only a post’s content but the posting mechanism itself before real use. My WordPress has a security plugin (one that blocks suspicious access automatically), which sometimes blocked requests unexpectedly. More on that below, but I made a few test drafts to check the behavior before settling the real workflow.

Having it read past posts to learn my blog’s voice

This is where I felt the biggest effect. The first post Claude Code wrote wasn’t bad in content, but rereading it, the tone clearly didn’t fit. The reason was simple: I’d had it write without reading this blog’s past posts.

So I had it get several past post URLs from the WordPress post list, read the actual text, then analyze the writing style. Its first post used the polite Japanese register, whereas my blog uses the plain one, so I corrected that. Now it reads these aspects from past posts as guidelines when writing:

  • Sentence endings (plain vs. polite register)
  • First person (telling it from real experience: “I”, “at my place”)
  • How headings are worded, how introductions open
  • Topics to avoid (areas already solved in practice, etc.)

Point it out once, and the policy stays in Claude Code’s memory. Next time it writes a different post, I don’t have to explain again; what I pointed out carries over automatically, which is a relief.

Automating posts to WordPress

Posting uses the WordPress REST API (the interface for operating on WordPress post data from outside programs), authenticated with an application password (a password just for program integrations, issued separately from your normal login password). Credentials sit in a config file; the posting script reads them, logs in, then sends the post data. That’s the whole mechanism.

All I did was issue an application password for Claude Code’s blog posting. You can issue one at the bottom of your profile page in the WordPress admin (Users → Profile).

Application password field on the WordPress profile page (Japanese UI)

The mechanism is simple, but I hit a few snags putting it together, mainly around the security plugin (WAF) on my WordPress, given that my blog shows program code:

  • Sending body text with the notation often used to show code (three backticks in a row) got blocked regardless of the content
  • Even after removing the cause, blocks sometimes continued for a while (a temporary restriction)
  • Sending the body as JSON (a format common for data exchange between programs), the longer the post, the more likely a block. Split into short pieces it passed, sent whole it got rejected: a reproducible behavior

In the end, switching the code parts to the syntax highlighting plugin’s own notation (no backticks), plus sending the body as application/x-www-form-urlencoded (a format that converts symbols before sending, often used in URLs) instead of JSON, made the blocks stop for good. My lesson: when you hit an unexplained error, suspect not only the data you send but also how you send it.

Having written all that, this part probably doesn’t matter much if you don’t deal with program code.

With that settled, I can put posts on WordPress just by specifying the title, body, status (draft/publish).

Categories, tags, featured images done for me too

Besides the body, Claude Code also prepares categories, tags, the featured image. For categories, it fetches the existing list; if none fits, it creates one under a given parent; existing ones get attached as they are. Tags work the same way. Not having to open the WordPress admin, ticking boxes one by one, is a quiet but big win.

For featured images, I first had it look back over the ones I’d made for past posts to find the common pattern. Luckily my blog basically uses one layout, “photo background, colored band in the middle, white text”, so it could make similar images right away. It adjusts font, text size, outlines etc. on request, so I look at the result, saying things like “make the text a bit bigger”. Uploading the finished image is done by Claude Code too.

My instructions to Claude Code are about this rough (translated):

“I put past featured images in (folder path); use them as reference to make one for this post, with [ClaudeCode] as the genre label. Add categories: create ClaudeCode as a new one under AI, attach it too, plus put it in the productivity/automation category. Add tags the same way.”

The overall setup

As a diagram, the flow so far looks like this (labels in Japanese):

Blog automation diagram: I discuss, review, approve with Claude Code; it learns style from past posts, verifies by web search, posts drafts with tags through the WordPress REST API, generates featured images; I do the final check, edits, publishing (Japanese labels)

As you can see, Claude Code does most of the work, but two things I always do myself: “discuss, review, approve”, then “final check, manual edits, publish”.

Everything in each section above was also set up mostly automatically while chatting with Claude Code in Japanese, so I didn’t need to specify detailed steps. Basically, tell Claude Code what you want, and it gets it done nicely.

Summary

What I felt from trying it: Claude Code isn’t just a tool that writes post text. It’s a sounding board for work experience, a researcher, the one implementing integrations. Having it read past posts to learn my blog’s voice in particular made a big difference to quality. If you’re wondering whether trending AI tools could make your blog easier to keep updated, it’s worth a try, dropping the idea that it’s only for engineers.

Some things are still open. I haven’t tried running draft creation automatically on a schedule, while cross-posting to social media is on hold. Once I try those, I’ll write about them.

コメント

Copied title and URL