Blog/Tutorial

How to Use OpenClaw to Write and Publish WordPress Posts via API

TUTORIAL2026-02-2610 min read
Laptop with blog writing setup and WordPress dashboard

Content is still king for SEO — but writing dozens of quality articles every month is exhausting. What if your AI agent did it for you? With OpenClaw, you can deploy a bot that researches topics, writes SEO-optimized posts, and publishes them directly to your WordPress site via the REST API, all without touching your CMS manually.

3–5×More content output with AI assistance
0 pluginsWordPress REST API is built-in since v5.6
< 5 minSetup time with ClawDock
24/7Your agent publishes while you sleep

Why Automate WordPress Publishing?

Most blogs fail at scale because the bottleneck is human writing time. AI agents like OpenClaw remove that bottleneck: you define topics, tone, and keywords once, and the agent produces structured, publication-ready posts on a schedule or on demand. Unlike generic ChatGPT copy-paste workflows, an OpenClaw agent can browse your existing posts, avoid duplicates, check keyword density, and post directly — all in one autonomous loop.

Step 1 — Enable the WordPress REST API

Good news: if you're running WordPress 5.6 or later (released 2020), the REST API is already active. You don't need any plugin. Every WordPress site exposes endpoints like:

bash
# List recent posts
GET https://yourdomain.com/wp-json/wp/v2/posts

# Create a new post
POST https://yourdomain.com/wp-json/wp/v2/posts

# Upload a featured image
POST https://yourdomain.com/wp-json/wp/v2/media
TIP

Verify your REST API is reachable by visiting https://yourdomain.com/wp-json/wp/v2/posts in a browser — you should see a JSON array of your posts.

Step 2 — Create an Application Password

WordPress Application Passwords let you authenticate API calls without sharing your main account password. They are scoped, revocable, and perfect for automation. Here's how to generate one:

  1. Log in to your WordPress admin panel (wp-admin)
  2. Go to Users → Profile (or Users → Edit User for another account)
  3. Scroll down to the "Application Passwords" section
  4. Enter a name like "OpenClaw Bot" and click Add New Application Password
  5. Copy the generated password immediately — it won't be shown again
INFO

Best practice: create a dedicated WordPress user with the Author or Editor role just for your OpenClaw agent. That way you can revoke access without affecting your main account.

Step 3 — Configure Your OpenClaw Agent

Your OpenClaw agent needs to know your WordPress URL and credentials. The cleanest approach is to store them as environment variables in your bot configuration and reference them in your system prompt. In ClawDock, you can pass these as part of your bot's channel configuration.

The key information your agent needs:

  • WordPress site URL (e.g., https://yourdomain.com)
  • WordPress username
  • Application Password (the one you generated in Step 2)
  • Default post status: draft or publish
  • Target categories or tags (optional)

Step 4 — Teach Your Agent to Publish Posts

OpenClaw agents can execute HTTP requests natively using their built-in web skills. Tell your agent how to construct a WordPress API call in its system prompt or via a dedicated skill. Here's the exact API call your agent should make:

javascript
// The OpenClaw agent constructs and executes this request
const username = 'your-wp-username';
const appPassword = 'xxxx xxxx xxxx xxxx xxxx xxxx';
const credentials = Buffer.from(`${username}:${appPassword}`).toString('base64');

const response = await fetch('https://yourdomain.com/wp-json/wp/v2/posts', {
  method: 'POST',
  headers: {
    'Authorization': `Basic ${credentials}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    title: 'Your AI-Generated Article Title',
    content: '<p>Full HTML content here...</p>',
    excerpt: 'Short summary for search previews.',
    status: 'draft',        // or 'publish' to go live immediately
    categories: [3, 7],     // WordPress category IDs
    tags: [12, 45],         // WordPress tag IDs
  }),
});

const post = await response.json();
console.log('Published post ID:', post.id, '— URL:', post.link);
WARNING

Always start with status: "draft" while testing. Once you've verified the formatting looks correct in WordPress preview, switch to status: "publish" for live automation.

Step 5 — Craft a System Prompt for SEO Content

The quality of your AI-generated content depends heavily on the instructions you give your OpenClaw agent. A well-structured system prompt transforms a generic chatbot into a disciplined SEO writer. Here's a proven template:

text
You are an SEO content writer for [Your Blog Name].

Your task: when asked to write a post about a topic, you will:
1. Research the topic using your web search tool
2. Identify the main keyword and 3–5 secondary keywords
3. Write a complete blog post following this structure:
   - Title: Include the main keyword, under 60 characters
   - Introduction (150 words): Hook + why this matters
   - 4–6 H2 sections with relevant H3 subsections
   - Practical examples, code snippets, or step-by-step lists
   - Conclusion with a clear call to action
4. Format the content as clean HTML (no Markdown)
5. Target 1,200–1,800 words for optimal SEO depth
6. After writing, publish to WordPress using the REST API

Style guidelines:
- Conversational but authoritative tone
- Short paragraphs (2–3 sentences max)
- Use numbered lists for processes, bullets for features
- Include at least one code example if the topic is technical

Step 6 — Automate on a Schedule

Once your agent publishes reliably, you can move from on-demand to scheduled publishing. OpenClaw supports time-triggered workflows — you can tell your agent to generate and publish one new post every Monday and Thursday, or whenever a competitor publishes something new (via RSS monitoring).

  • Weekly schedule: "Every Monday, write a post about a trending topic in [your niche]"
  • Competitor monitoring: "Check competitor's sitemap weekly and write a better version of their top article"
  • Keyword gap filling: "Search for questions about [topic] that we haven't covered yet, then write about the top result"
  • Content refresh: "Find posts older than 1 year on our site and update them with new information"

What This Does for Your SEO

Consistent, quality content publishing is one of the highest-leverage SEO activities. Google's algorithms favor sites that publish regularly and deeply on their niche. An OpenClaw agent running on ClawDock can give a small blog the content velocity of a 10-person editorial team:

MetricManual BlogWith OpenClaw Agent
Posts per month2–420–40
Time per post3–5 hours~5 minutes supervision
Keyword researchSeparate tool neededBuilt into agent workflow
PublishingManual login + formatFully automated via API
CostWriter feesToken costs (~$0.05/post)

Content Quality & Safety Guardrails

Automating content publishing requires guardrails to maintain quality and avoid issues like duplicate content, inaccurate facts, or Google penalties. Build these safeguards into your agent's instructions:

  • Always set status: "draft" for new agents — review before publishing
  • Instruct the agent to cite sources and include links to references
  • Use the WordPress duplicate check endpoint before posting (GET /wp-json/wp/v2/posts?search=title)
  • Run generated content through a uniqueness check using web search
  • Set a minimum word count (1,000+) to avoid thin content penalties
  • Review the first 10 posts manually before enabling full autopilot

The best AI content strategy is one where AI handles the research and first draft, and you provide the strategic direction and final editorial eye.

ClawDock Content Team

Deploy Your WordPress Agent in Minutes

With ClawDock, you can have a WordPress publishing agent running in under 5 minutes. Deploy an OpenClaw bot, paste your system prompt with your WordPress credentials, and start it on Telegram or any other channel. Send it a topic — it researches, writes, and publishes while you focus on strategy.

Deploy Your WordPress AI Agent

Get an OpenClaw bot running in 2 minutes. Connect it to WordPress and start publishing SEO content on autopilot.

Deploy Free
openclaw wordpressai blog automationwordpress rest api aiauto publish wordpressopenclaw seo automationai content generation wordpress

Deploy Your OpenClaw Bot in Minutes

No servers. No config files. Just your bot, live.