Every week on Reddit, someone asks the same thing. How do I get an AI agent to write a blog post and push it to WordPress automatically, with a featured image, without it going live by accident? If you have been down this road, you know the messy part is not the writing. It is the publishing glue.
In this tutorial I will show you a setup that actually works. We use Hermes Agent to do the research and writing, and the WordPress REST API with an Application Password to create the post as a draft, attach a featured image, and only publish when you say so. No n8n canvas, no paid middleware. Just a script and a credential.
Why publish as a draft first?
The number one mistake in automated blogging is skipping the human check. Models hallucinate URLs, mangle facts, and sometimes produce content that reads like a brochure. Creating the post as a draft keeps you in control. The agent does the heavy lifting, and you hit publish after a thirty second scan. In my experience, this single habit saves more reputation than any prompt trick.
Drafts also protect your SEO. A half finished or factually wrong post that gets indexed can hurt you for months. Keep it private until it is genuinely good.
What you will need
- A WordPress site with HTTPS (we use
ai.chhatramani.com.npas the example). - Hermes Agent installed and running (terminal, messaging, or IDE).
- An Application Password from WordPress (not your login password).
- Python 3 with the
requestslibrary on the machine that runs the publisher.
Step 1: Create a WordPress Application Password
Open your WordPress admin, go to Users, edit your profile, and scroll to Application Passwords. Give it a name like hermes-agent and click Add. WordPress shows a password that looks like xxxx xxxx xxxx xxxx xxxx xxxx. Copy it now. You will not see it again.
This is not the same as your login password, and that distinction matters. Application Passwords are scoped, can be revoked individually, and never expose your account credentials. If a script leaks one, you delete it in the admin and move on.
Step 2: Store your credentials safely
Never paste secrets into the post body. Put them in a small config file in your home directory:
{
"site_url": "https://ai.chhatramani.com.np",
"username": "chhatramani",
"password": "xxxx xxxx xxxx xxxx xxxx xxxx"
}
Save it as ~/.ai_blog_config.json. Your publisher reads it at runtime, so the password never lives in the script. Lock the file down with chmod 600 if you are on Linux or macOS.
Step 3: Let Hermes Agent do the research and writing
This is where Hermes earns its keep. You give it a task like: search Reddit for trending AI questions, read the latest docs, and draft a 1500 word tutorial in a human voice with inline images. Hermes has a terminal, web search, memory, and skills, so it can pull real sources instead of guessing.
The trick is to be specific about voice. Tell it to avoid em dashes, write like a person, and cite real links. A vague prompt produces a vague post. A constrained prompt produces something you can actually publish.
If you want Hermes to also serve as an HTTP backend for your own tooling, you can enable its API server. Add this to ~/.hermes/.env:
API_SERVER_ENABLED=true
API_SERVER_KEY=change-me-local-dev
Then start it:
hermes gateway
You will see [API Server] API server listening on http://127.0.0.1:8642. Any OpenAI-compatible client can now talk to Hermes at http://localhost:8642/v1. This is optional for blogging, but handy if you are wiring Hermes into a larger pipeline.
Step 4: Publish the post as a draft with a featured image
The publisher below does three things. It uploads a remote image URL to the WordPress media library, sets it as the featured image, and creates the post under your chosen category. Critically, it defaults to draft.
import requests, json
from requests.auth import HTTPBasicAuth
cfg = json.load(open("/home/you/.ai_blog_config.json"))
auth = HTTPBasicAuth(cfg["username"], cfg["password"])
site = cfg["site_url"].rstrip("/")
# 1) upload the featured image
img = requests.get("https://images.unsplash.com/photo-...?w=1200&q=80",
headers={"User-Agent": "Mozilla/5.0"}, timeout=30).content
m = requests.post(f"{site}/wp-json/wp/v2/media", auth=auth,
headers={"Content-Disposition": 'attachment; filename="hero.jpg"',
"Content-Type": "image/jpeg"}, data=img, timeout=90).json()
# 2) create the post as a DRAFT
post = {
"title": "Your Tutorial Title",
"content": "<p>HTML body here...</p>",
"status": "draft",
"categories": [3],
"featured_media": m["id"]
}
r = requests.post(f"{site}/wp-json/wp/v2/posts", auth=auth, json=post, timeout=60)
print(r.json().get("link"))
That is the whole glue layer. The image URL must be a real, downloadable link. If the upload fails, the post still publishes, just without a thumbnail, so your pipeline never hard crashes.
Step 5: Review, then publish
Open the draft link. Check the facts, the links, and the voice. When it reads right, flip it live with one call:
requests.post(f"{site}/wp-json/wp/v2/posts/{post_id}",
auth=auth, json={"status": "publish"})
If you trust the content, you can set status to publish from the start. I prefer the draft step until the agent has earned it.
Step 6: Schedule it with Hermes cron
Doing this by hand every day gets old fast. Hermes supports scheduled jobs, so you can generate a fresh draft every morning and review it with your coffee. A schedule looks like this:
schedule: "0 9 * * *" # daily at 9am
prompt: "Search Reddit for a trending AI how-to question, research the latest docs, write a 1500 word tutorial in a human voice, and create it as a DRAFT on WordPress using the ai-tutorial-agent skill."
The job runs in a clean session, so the prompt must be self contained. Tell it exactly which skill to load and which category to use. The draft lands in WordPress, and you decide what goes live.
Step 7: Make auto-published posts rank
Automatic does not mean careless. To get cited by both Google and AI assistants, follow a few rules. Use question based headings like How do I publish a draft with the REST API?. Answer in one sentence, then expand. Name real entities: WordPress, Hermes Agent, Application Password, REST API. Add a FAQ block at the end. Include a plain meta description. These habits come straight from LLM SEO practice, and they are what separate a post that gets read from one that gets buried.
Step 8: Generate hero images with AI
Stock photos work, but a custom hero performs better and looks more like your brand. If your Hermes setup includes an image backend, generate a hero from a text prompt and upload it the same way. The upload step does not care where the bytes came from, only that they are a valid image. Just make sure the file is a real jpg or png before you send it.
Common pitfalls and how to avoid them
| Pitfall | Fix |
|---|---|
| Login password rejected | Use an Application Password, not your account password. |
| Featured image 401/403 | Confirm the image URL is public and sends an image content type. |
| Post goes live too soon | Default to draft, publish manually after review. |
| Duplicate images in body | Keep the hero as featured only, or reuse it intentionally for tutorials. |
| Empty or broken drafts | Log the API response. A 4xx means auth or payload; a 5xx means retry later. |
Frequently asked questions
Do I need n8n or Zapier for this?
No. The WordPress REST API plus a small Python script covers research, writing, drafting, and publishing.
Can Hermes Agent run this on a schedule?
Yes. Hermes supports cron style scheduled jobs, so you can generate a fresh draft every morning and review it later.
Is an Application Password safe?
Safer than your login password because it is scoped, revocable, and does not expose your account credentials. Store it in a config file, not in code.
What if the image download fails?
The post still publishes as a draft without a featured image. Fix the URL and re attach the media later.
Can I set the category and tags?
Yes. Pass categories and tags as arrays of WordPress term IDs in the post payload.
How do I make sure the post ranks?
Use question headings, answer first, name real tools, add a FAQ, and write a plain meta description. That is the core of LLM SEO.
References: Hermes Agent API Server docs → WordPress REST API handbook →
Updated July 11, 2026.