Content creation is time-consuming. But what if you could tell your local AI assistant to research a topic, write a comprehensive article, format it perfectly, and push it directly to your WordPress dashboard—all in the background while you keep working?
Using OpenClaw, a powerful local AI agent framework, you can do exactly that by spawning autonomous “sub-agents.” In this full project walkthrough, we’ll build a seamless pipeline to manage WordPress posts automatically.
Why did I decide to build it this way? (Local Agents vs. Cloud SaaS)
Before we jump into the setup, you might be wondering: why not just use a paid AI blogging tool? The answer comes down to privacy, cost, and absolute control. Let’s figure this out together.
- Zero SaaS Subscriptions: You aren’t paying high monthly fees for a wrapper app. You run the LLM and agent framework locally for free.
- Complete Privacy: You own your data, your API keys, and your prompts. Nothing leaks to third-party dashboards.
- Unlimited Flexibility: Because we are using an open-source agent framework, we can write custom Python scripts to extend its capabilities however we want.
Project Overview
Here is what we are going to build:
- The Goal: An AI workflow where a “manager” agent delegates a blog writing task to an isolated “sub-agent.”
- The Tools: OpenClaw (for the agent framework), WordPress REST API (for publishing), and Python.
- The Result: A fully formatted draft sitting in your WordPress backend, complete with headers, code blocks, and formatting, ready for your final human review.
Step 1: Preparing WordPress (App Passwords)
First, we need to securely connect our agent to WordPress without hardcoding our real admin password.
- Log in to your WordPress dashboard.
- Navigate to Users > Profile.
- Scroll down to the Application Passwords section.
- Enter a name like ‘OpenClaw Sub-Agent’ and click Add New Application Password.
- Copy the 24-character password generated. You won’t be able to see it again!
Step 2: Installing the WordPress API Skill
OpenClaw uses modular skills to interact with external services. Instead of building the API integration from scratch, we can install the pre-built WordPress skill directly from ClawHub.
Run the following command in your terminal to install it:
openclaw skills install @codedao12/wordpressOnce installed, locate the WordPress skill configuration in your workspace (usually under skills/wordpress/config/sites.json) and add your credentials:
{
"sites": {
"my-blog": {
"url": "https://yourwebsite.com",
"username": "admin_user",
"app_password": "xxxx xxxx xxxx xxxx xxxx xxxx",
"description": "My Personal Tech Blog"
}
}
}Step 3: Designing the Agent Task Prompt
Now, how do we trigger this? In OpenClaw, you can talk to your primary agent and ask it to spawn a sub-agent. The key is giving the sub-agent a very explicit task definition so it knows exactly what to write and how to format it.
Here is an example prompt you would send to your OpenClaw assistant:
Spawn a sub-agent to write a blog post about "The Future of Local AI Agents."
Instructions for the sub-agent:
1. Research the latest trends in local AI.
2. Write a 1,000-word tutorial.
3. Convert the content into WordPress Gutenberg HTML blocks.
4. Use the `wordpress` skill to push it to the 'my-blog' site as a "draft".
5. Yield completion when the draft ID is returned.Step 4: Under the Hood (The Sub-Agent Execution)
When you issue the command above, OpenClaw runs a sessions_spawn tool. This creates a sandboxed parallel session. While you continue your conversation or work on other things, the sub-agent goes through the following loop in the background:
- Search & Compile: Uses web search tools to gather current info.
- Drafting: Uses its LLM context to write the post.
- API Execution: Runs the WordPress CLI wrapper to push the payload:
./wp.sh my-blog create-post --title "The Future of Local AI Agents" --content "..." --status "draft"Under the hood, the WordPress REST API expects a structured JSON payload. Here is a simplified look at exactly what the agent sends to your site:
{
"title": "The Future of Local AI Agents",
"content": "Your generated content here...
",
"status": "draft"
}Step 5: Review and Publish
Once the sub-agent yields completion, your main assistant will notify you: “The draft has been successfully created with ID 1042.”
All you have to do is log into your WordPress backend, open the Drafts folder, do a quick human review, add a featured image, and hit Publish.
FAQ & Troubleshooting
What if I get a 403 Forbidden error?
Does this support custom post types?
Can the agent generate featured images?
Related Reading
Conclusion
By delegating content generation and API publishing to an autonomous sub-agent, you eliminate the friction of formatting, copy-pasting, and context switching. OpenClaw handles the heavy lifting, letting you focus strictly on strategy and final editing. Try setting up your first sub-agent today!