WordPress + Leonardo AI: publish posts effortlessly
Writing the post is only half the work. The rest is the tedious part: tightening sections, hunting for sources, generating a decent featured image, uploading it, fixing ALT text, then finally publishing without breaking formatting.
This is where WordPress AI publishing helps. Content marketers feel it first, honestly. But consultants shipping weekly insights and small teams running a company blog end up stuck in the same loop. The outcome is simple: a publish-ready post with a clean featured image, produced with far fewer handoffs.
This workflow takes a topic, drafts a full article, generates a Leonardo AI featured image, and publishes to WordPress. You’ll see how the automation works, what you need, and where people usually get tripped up.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: WordPress + Leonardo AI: publish posts effortlessly
flowchart LR
subgraph sg0["When clicking ‘Execute workflow’ Flow"]
direction LR
n0@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If", pos: "b", h: 48 }
n1@{ icon: "mdi:play-circle", form: "rounded", label: "When clicking ‘Execute workf..", pos: "b", h: 48 }
n2["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Style"]
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Extract Topic"]
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Build Chat Research Body"]
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Research Topic – GPT"]
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Build Tone Request"]
n7["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Tone & Format Revision – GPT"]
n8["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Word Count Guard"]
n9@{ icon: "mdi:robot", form: "rounded", label: "Expand Draft", pos: "b", h: 48 }
n10["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Get Title, Content, and Imag.."]
n11@{ icon: "mdi:robot", form: "rounded", label: "Message a model", pos: "b", h: 48 }
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Leonardo: Create Post Image"]
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Code"]
n14@{ icon: "mdi:cog", form: "rounded", label: "Wait", pos: "b", h: 48 }
n15["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Get Leonardo Image Status"]
n16["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Get Leonardo Image"]
n17["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Upload Image to Wordpress"]
n18["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Add ALT to Image"]
n19["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Create WordPress Post"]
n0 --> n9
n0 --> n10
n13 --> n14
n14 --> n15
n2 --> n4
n9 --> n10
n3 --> n2
n11 --> n12
n18 --> n19
n8 --> n0
n6 --> n7
n16 --> n17
n5 --> n6
n4 --> n5
n15 --> n16
n17 --> n18
n12 --> n13
n7 --> n8
n1 --> n3
n10 --> n11
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n1 trigger
class n9,n11 ai
class n0 decision
class n5,n7,n12,n15,n16,n17,n18,n19 api
class n2,n3,n4,n6,n8,n10,n13 code
classDef customIcon fill:none,stroke:none
class n2,n3,n4,n5,n6,n7,n8,n10,n12,n13,n15,n16,n17,n18,n19 customIcon
The Problem: Publishing Is Still Too Manual
A solid draft shouldn’t turn into a 30-step checklist, but that’s what publishing often becomes. You finish writing, then lose momentum while cleaning HTML, double-checking the structure, adding sources, and rewriting titles to fit SEO. After that comes the image scramble: you either settle for stock photos that look like everyone else, or you burn time prompting, downloading, re-uploading, and fixing ALT text. And if you publish frequently, small mistakes sneak in. A broken link here, missing category there, a thin “sources” section that makes your post feel less credible.
The friction compounds, especially when you’re trying to stay consistent.
- Turning a topic into a structured article can take about 2 hours when you include research, formatting, and polishing.
- Featured images often become a bottleneck, because generating one, checking it, and uploading it is repetitive but easy to mess up.
- Quality checks are inconsistent when you’re rushing, which means short posts slip through and require rewrites later.
- Source links and SEO details get added late, so the post looks “done” but isn’t actually ready to publish.
The Solution: Topic to Published WordPress Post (With a Featured Image)
This n8n workflow starts with a simple input (manual trigger, or something you pass in from chat, Telegram, or a webhook) and turns it into a WordPress post you can actually ship. First, it extracts and cleans the topic, even if you paste something messy like “/topic …” commands. Then it applies a style guide so your posts stay consistent: practical tone, clear sections, and clean HTML that won’t fight the WordPress editor. After that, it runs an AI research request, generates a full draft, and polishes it for readability. A word-length guard checks the output, and if it comes out thin, it automatically expands the sections that usually need substance (“why it matters,” risks, and the action plan). Finally, it creates a text-free, editorial-style featured image via Leonardo AI, uploads it to WordPress with sensible ALT text, compiles sources into clickable links, and publishes immediately.
The workflow begins when you provide a topic. AI handles research, drafting, tone revision, and minimum word count checks. Then Leonardo AI generates the featured image while n8n waits for it to finish, uploads it to WordPress, and publishes the post with sources and categories in place.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you publish three posts a week. Manually, a realistic process is about 2 hours to draft and polish, plus maybe 30 minutes to create a usable featured image, upload it, and fix ALT text, which is roughly 7 to 8 hours a week. With this workflow, you spend about 10 minutes submitting the topic and later reviewing the draft. Leonardo image generation and uploading runs in the background (there’s a built-in wait), so you’re mostly just approving the final output. Most teams get several hours back every week, and the posts ship more consistently.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- WordPress site for publishing posts and uploading media
- Leonardo AI to generate the featured image
- API credentials (WordPress Application Password, Leonardo API key)
Skill level: Intermediate. You’ll connect APIs, copy credentials, and test a few runs to match your blog’s style.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
Topic comes in. You trigger the workflow manually (or feed it a message from chat/Telegram/webhook), and n8n extracts the real topic from whatever you pasted.
Research and drafting happen next. The workflow assembles a research prompt, calls an AI research endpoint, then rewrites the draft to match your style guide so the sections stay predictable and easy to scan.
Quality control kicks in. A word-length gate checks for at least 1,600 words. If the draft is short, it expands the parts that usually feel thin, then merges everything into a final version.
Image + publishing finishes the job. It generates a clean image prompt, sends it to Leonardo AI, waits for completion, retrieves the image file, uploads it to WordPress, sets ALT text, and publishes the post with sources compiled into clickable links.
You can easily modify the style guide to match your brand voice, or change how categories are assigned based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Manual Trigger
Start the workflow manually so you can validate the topic extraction and AI research output before publishing.
- Add the Manual Execution Start node as the trigger.
- Connect Manual Execution Start to Derive Topic.
Step 2: Connect OpenAI for Research and Editing
This workflow uses multiple AI calls for research, tone editing, and expansion. Configure OpenAI credentials across the research and LLM nodes.
- In AI Research Request, set URL to
https://api.openai.com/v1/chat/completionsand JSON Body to={{$json}}. - Credential Required: Connect your openAiApi credentials in AI Research Request.
- In AI Tone Revision, set URL to
https://api.openai.com/v1/chat/completionsand JSON Body to={{ $json }}. - Credential Required: Connect your openAiApi credentials in AI Tone Revision.
- Open Expand Article Draft and confirm Model is set to
gpt-4.1with JSON Output enabled. - Credential Required: Connect your openAiApi credentials in Expand Article Draft.
- Open Generate Image Prompt and confirm the prompt includes
{{ $json.title }}and{{ $json.content }}. - Credential Required: Connect your openAiApi credentials in Generate Image Prompt.
Step 3: Configure Research and Tone Processing Nodes
These code nodes build the style guide, construct prompts, and guard word length before content is prepared for image generation and publishing.
- In Compose Style Guide, keep the default style rules and clean HTML constraints as provided.
- In Assemble Research Prompt, verify the model is
gpt-4o-miniand that it returns a JSON object with"title"and"content". - In Prepare Tone Edit, confirm it builds a JSON edit request with
model: "gpt-4o-mini"andtemperature: 0.4. - In Word Length Gate, verify the minimum word count logic uses
const MIN = 1600. - In Branch Condition, ensure the boolean condition checks
=={{ $json.need_expand }}equalstrue. - Confirm the flow is Manual Execution Start → Derive Topic → Compose Style Guide → Assemble Research Prompt → AI Research Request → Prepare Tone Edit → AI Tone Revision → Word Length Gate → Branch Condition.
Step 4: Configure Image Generation and Retrieval
This stage generates a featured image using Leonardo, waits for completion, and retrieves the generated file.
- In Leonardo Image Create, set URL to
https://cloud.leonardo.ai/api/rest/v1/generationsand keep the JSON body with"prompt": "{{ $json.message.content }}". - Credential Required: Connect your httpBearerAuth credentials in Leonardo Image Create.
- In Capture Generation ID, keep the ID extraction logic to output
generationId. - In Pause Execution, set Amount to
30seconds to allow the image to render. - In Fetch Image Status, set URL to
=https://cloud.leonardo.ai/api/rest/v1/generations/{{ $json.generationId }}. - Credential Required: Connect your httpBearerAuth credentials in Fetch Image Status.
- In Retrieve Image File, set URL to
={{ $json.generations_by_pk.generated_images[0].url }}.
30 seconds or implement a polling loop.Step 5: Configure WordPress Media and Publishing
Upload the generated image, set its alt text, and publish the final post in WordPress.
- In Upload Image to WordPress, set URL to
https://public-api.wordpress.com/wp/v2/sites/[YOUR_ID]/mediaand Content Type tobinaryData. - Credential Required: Connect your oAuth2Api credentials in Upload Image to WordPress. (Optional secondary: httpBasicAuth if your WordPress setup requires it.)
- In Set Image Alt Text, set URL to
=https://public-api.wordpress.com/wp/v2/sites/[YOUR_ID]/media/{{ $json.id }}and alt_text to={{ $('Generate Image Prompt').item.json.message.content }}. - Credential Required: Connect your oAuth2Api credentials in Set Image Alt Text. (Optional secondary: httpBasicAuth.)
- In Publish WordPress Post, set URL to
https://public-api.wordpress.com/wp/v2/sites/[YOUR_ID]/posts. - Set JSON Body to
{{ { "title": $("Parse Title Content Image").item.json.title, "content": $("Parse Title Content Image").item.json.content, "status": "publish", "categories": ["[YOUR_ID]"], "featured_media": $("Upload Image to WordPress").item.json.id } }}. - Credential Required: Connect your oAuth2Api credentials in Publish WordPress Post. (Optional secondary: httpBasicAuth.)
[YOUR_ID] in all WordPress URLs and the categories array or the post will fail to publish.Step 6: Test and Activate Your Workflow
Validate the full end-to-end pipeline before turning it on for production use.
- Click Execute Workflow to run from Manual Execution Start and observe outputs through Publish WordPress Post.
- Confirm that Parse Title Content Image returns a valid
title,content, andimage_filename. - Verify Upload Image to WordPress returns a media
idand Publish WordPress Post creates a published post. - Once validated, toggle the workflow to Active for production use.
Common Gotchas
- WordPress credentials can expire or lack the right permissions. If things break, check your Application Password and user role capabilities first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About 30 minutes if your WordPress and Leonardo credentials are ready.
No. You’ll mostly paste API keys and adjust a few text settings. The hardest part is deciding what “good enough to publish” means for your brand.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Leonardo AI usage and whatever AI research/drafting endpoint you connect for the HTTP requests.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, but you’ll change the final WordPress publish call to create a draft or future-dated post instead. The simplest approach is adjusting the “Publish WordPress Post” request so it sets status to draft (or schedules a publish date). Common customizations include swapping the style guide, changing category rules, and tightening the minimum word count gate so shorter posts get expanded automatically.
Most of the time it’s an Application Password issue, either revoked or tied to a user that can’t upload media. Update the credentials in n8n and confirm the account can create posts and upload images. If publishing works but image upload fails, check the WordPress site’s security plugins and file upload limits because they can block REST requests. Also look for rate limiting on hosts that aggressively throttle repeated requests.
A lot, as long as your n8n plan and your AI/image providers can keep up. On n8n Cloud, your limit is mainly monthly executions, so higher volume means a bigger plan. If you self-host, there’s no execution cap, but your server resources become the limit. In practice, this workflow is “batchable,” but Leonardo image generation time and the Wait step mean you’ll want to stagger runs if you’re publishing dozens in a day.
For this kind of workflow, n8n is usually a better fit because you can do branching, gates (like word count checks), and multi-step waits without the automation turning into a fragile chain of mini-zaps. Self-hosting is also a big deal if you publish often and don’t want every run priced per task. Zapier or Make can be fine for lighter two-step flows, like “new row → create draft.” If you’re unsure, map the full process you want first (drafting, revisions, image generation, upload, publish). Then pick the tool that can handle the whole thing without workarounds. Talk to an automation expert if you want a quick recommendation.
Once this is running, publishing stops feeling like a chore you have to psych yourself up for. The workflow handles the repetitive parts so you can focus on the final review and the ideas that actually move your business.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.