Automate WordPress Posts Using n8n and AI for SEO Content

This workflow automates the creation of WordPress draft posts using AI, starting from user-provided keywords. It solves the time-intensive challenge of writing structured, SEO-friendly articles by generating titles, chapters, and featured images automatically.
openAi
WordPress
FormTrigger
+7
Workflow Identifier: 1161
NODES in Use: FormTrigger, Set, If, SplitOut, Merge, Code, WordPress, HttpRequest, openAi, toolWikipedia

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Workflow Does

This workflow takes a few keywords, number of chapters, and max word count as inputs.
It creates a full draft post on WordPress with AI-written text and an AI-generated image.
It solves the problem of slow and manual blog writing by automating title, outline, chapter content, and image creation.
The output is a ready-to-edit draft post with a featured image in WordPress.

This saves time and makes content production faster and easier for content managers.


Who Should Use This Workflow

Content creators who want to speed up writing blog posts without hiring more writers.
Digital marketing teams needing SEO-friendly articles automatically.

Anyone managing WordPress sites wanting AI help with content and images.
Users who want to produce consistent, good-quality drafts from just keyword ideas.


Tools and Services Used

  • n8n: Automates the workflow and connects all services.
  • OpenAI GPT-4: Generates article outlines, chapters, and prompts.
  • Wikipedia API: Checks facts and improves content accuracy.
  • DALL-E (OpenAI): Creates AI-generated featured images.
  • WordPress REST API: Posts article drafts and uploads images.

Beginner Step-by-Step: How to Use This Workflow in n8n

Download and Import

  1. Download the workflow file using the Download button on this page.
  2. Open your n8n editor.
  3. Click “Import from File” and select the downloaded workflow file.

Configure Credentials

  1. Enter your OpenAI API key in the OpenAI credential settings.
  2. Set your WordPress URL and create credentials (username and application password or OAuth).
  3. Update any IDs, emails, channels, folders, or tables if the workflow uses custom values.

Setup Variables

  1. Check the Set node to confirm the WordPress API URL and variable names.
  2. Adjust form field names if needed based on your usage.

Test and Activate

  1. Submit a test request via the form URL generated by the Webhook node.
  2. Watch the workflow execution in n8n to confirm it runs without errors.
  3. Verify the draft post and the featured image appear in WordPress.
  4. Activate the workflow in n8n to run for production use.

For users running self-host n8n, the import and activation steps are the same.


Inputs, Processing, and Output Overview

Inputs

  • Keywords (comma-separated) from a form.
  • Number of chapters for the article.
  • Maximum word count allowed.

Processing Steps

  1. The workflow uses GPT-4 to create an article outline with title, subtitle, intro, chapters, conclusions, and image prompt.
  2. It checks if the outline has all needed parts.
  3. The workflow splits the chapters and generates full text for each chapter using GPT-4.
  4. Each chapter content is merged together with introduction and conclusions, formatted in HTML.
  5. DALL-E creates a matching featured image based on the outline’s image prompt.
  6. The image is uploaded to WordPress media library via API.
  7. The article draft is created on WordPress with the HTML content and post title.
  8. The uploaded image is linked as the post’s featured image.

Output

A draft post on WordPress with complete article text and a featured image.
The post is ready for review and final publishing.


Common Problems and Solutions

  • Problem: GPT-4 returns incomplete article outline.
    Cause: API token limit or prompt issue.
    Fix: Use fewer chapters or increase max tokens in OpenAI nodes.
  • Problem: WordPress API upload fails with 401 Unauthorized.
    Cause: Wrong credentials or permissions.
    Fix: Check your WordPress application password and user rights, re-link credentials in n8n.
  • Problem: Featured image does not show on draft.
    Cause: Wrong media ID used.
    Fix: Ensure HTTP request node updates post with correct media ID matching uploaded image.

Customization Ideas

  • Change max number of chapters in Webhook node form field dropdown.
  • Tweak word count per chapter in OpenAI prompt or formulas within the nodes.
  • Adjust WordPress URL in Set node for different sites.
  • Modify image prompt style and size in DALL-E generation node for different looks.
  • Improve Wikipedia data queries in GPT-4 prompts for better fact checks.

Code Sample for Assembling Article HTML

This Code node combines intro, chapters, and conclusions into HTML:

let article = "";

// Introduction
article += $('Create post title and structure').first().json.message.content.introduction;
article += "<br><br>";

for (const item of $input.all()) {
 article += "<strong>" + item.json.title + "</strong>";
 article += "<br><br>";
 article += item.json.message.content;
 article += "<br><br>";
}

// Conclusions
article += "<strong>Conclusions</strong>";
article += "<br><br>";
article += $('Create post title and structure').first().json.message.content.conclusions;


return [
 {
 "article": article
 }
];

Use this code by copying into the respective Code node inside the workflow.


Summary and Result

✓ Saves hours weekly by automating blog post writing.
✓ Produces SEO-friendly articles with logical chapter structure.
✓ Creates AI images and publishes posts as drafts ready for review.
→ Makes content creation simpler for content managers.
→ Delivers consistent, quality WordPress draft posts from keywords.


Frequently Asked Questions

Yes, the workflow supports different OpenAI models or AI providers available in n8n, but GPT-4 usually gives the best content quality and coherence.
The workflow calls GPT-4 multiple times for outline and chapters, so the usage depends on chapter count and word limits set. Adjusting these can control API costs.
The workflow integrates Wikipedia API queries to validate and improve factual accuracy of the article content.
Verify API credentials such as application passwords, user permissions, and ensure OAuth or basic auth is correctly configured in the WordPress node.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free