Home / n8n Workflow Templates / Automated AI-Powered WordPress Blog Post Generator with SEO Optimization

Automated AI-Powered WordPress Blog Post Generator with SEO Optimization

The Ultimate Guide to Optimize WordPress Blog Posts with AI

This n8n workflow automates the creation of SEO-optimized blog posts for WordPress using AI. It generates articles and titles from prompts in Google Sheets, creates drafts, uploads featured images, sets metadata via Yoast, and updates the sheet with results.

Manual13 nodesAI & MLGoogle DriveDeepSeekWordpress

About this workflow

The Ultimate Guide to Optimize WordPress Blog Posts with AI – N8n Workflow Analysis

This n8n workflow template is a fully automated content generation and optimization pipeline designed to streamline the creation of high-quality, SEO-optimized blog posts for WordPress sites. It leverages artificial intelligence (AI), Google Sheets as a content planning interface, and direct integrations with WordPress and AI language models to deliver a complete end-to-end blogging solution — from ideation to publication-ready drafts with metadata and featured images.

The system is ideal for content marketers, bloggers, SEO specialists, and agencies managing multiple WordPress blogs who want to scale content production without sacrificing quality or search engine performance.


What the Workflow Does

This workflow automates the entire lifecycle of creating an optimized blog post:

  1. Reads a topic prompt from a Google Sheet.
  2. Generates a full HTML-formatted article using AI.
  3. Creates a compelling, SEO-friendly title.
  4. Produces a realistic AI-generated cover image.
  5. Uploads the image and assigns it as the featured image in WordPress.
  6. Publishes a draft blog post on WordPress.
  7. Analyzes the published content to generate optimized meta title and meta description.
  8. Updates the original Google Sheet with all relevant details including URL, title, ID, date, and SEO metadata.

All steps are orchestrated seamlessly within n8n, requiring minimal manual intervention after initial setup.


Key Features and Capabilities

Feature Description
AI-Powered Content Generation Uses DeepSeek via OpenAI-compatible API to generate both articles and titles tailored for SEO.
SEO Optimization Automation Automatically generates Yoast-compatible meta tags (title & description) based on content analysis.
Featured Image Automation Integrates DALL·E (via OpenAI) to create professional-grade cover photos, uploads them to WordPress media library, and sets them as featured images.
WordPress Integration Directly interacts with the WordPress REST API to create, update, and enrich posts.
Google Sheets as CMS Interface Allows users to manage topics and track outputs directly in a familiar spreadsheet environment.
Structured Output Parsing Ensures clean extraction of meta tags using schema-based parsing for reliability.
Modular & Visual Design Clear node layout with sticky notes explaining each phase, making it easy to understand and modify.

Additionally, this workflow uses advanced prompting techniques to ensure that:

  • Articles follow logical structure (introduction, 2–3 chapters, conclusion).
  • HTML formatting is used appropriately (no Markdown).
  • Titles stay under 60 characters.
  • Meta descriptions are concise, keyword-rich, and include CTAs.

Main Nodes and Their Purposes

Below is a breakdown of the core nodes and their roles in the workflow:

1. When clicking ‘Test workflow’ (Manual Trigger)

  • Purpose: Initiates the workflow manually.
  • Use Case: Ideal for testing or triggering single-post generation.

2. Get context (Google Sheets Node)

  • Function: Fetches data from a specific row in a Google Sheet where the "ID POST" matches a lookup value.
  • Input: Topic (PROMPT) from the sheet.
  • Output: Contextual data passed downstream for processing.

3. Set context (Set Node)

  • Purpose: Extracts the PROMPT field from the sheet and stores it as a variable for use in subsequent AI prompts.

4. Generate article (DeepSeek AI Model via LangChain)

  • Model Used: deepseek-chat
  • Prompt Logic: Instructs AI to write a well-structured, ~300–500 word SEO-friendly article with intro, body, and conclusion.
  • Formatting Rules: Outputs pure HTML (paragraphs, bold, italics, lists), no code blocks or markdown.

5. Generate title (DeepSeek AI Model)

  • Objective: Generate a concise, keyword-rich title ≤60 characters.
  • Constraints: No quotes, no HTML entities, only natural punctuation like commas and ampersands.

6. Add draft to WP (WordPress Node)

  • Action: Creates a new draft post in WordPress.
  • Fields Set: Title (from AI), content (from AI-generated article), status = draft.
  • Output: Returns the newly created post’s ID and URL.

7. Generate image (OpenAI DALL·E Image Generation)

  • Triggered After Draft Creation
  • Prompt Source: Uses the AI-generated title to craft a photorealistic image concept.
  • Settings: 1024x1024 resolution, natural style, HD quality.
  • Example Prompt: "Generate a real photo image used as a blog post cover: [Generated Title], photography, realistic, sigma 85mm f/1.4"

8. Upload image (HTTP Request to WordPress Media API)

  • Action: Sends the generated binary image to /wp-json/wp/v2/media.
  • Headers: Sets filename dynamically using the post ID (copertina-{id}.jpg).

9. Set image (HTTP Request to Assign Featured Media)

  • Action: Patches the WordPress post to assign the uploaded image as the featured media using its ID.

10. Update Sheet (Google Sheets Update Operation)

  • Purpose: Records key details back into the original Google Sheet:
    • Post URL
    • Date of creation
    • Title
    • WordPress Post ID
    • Row number (for future reference)

This ensures traceability and prevents reprocessing.

11. SEO Expert (LangChain Chain LLM Node)

  • Role: Acts as an expert SEO optimizer analyzing the final article.
  • Inputs: Title, content, excerpt.
  • Instructions: Follows comprehensive SEO best practices to generate:
    • Meta title (≤60 chars)
    • Meta description (≤160 chars)
  • Guidelines Include: Keyword placement, CTA inclusion, SERP optimization, brand alignment.

12. OpenRouter Chat Model + Structured Output Parser

  • Model Used: google/gemini-2.0-flash-exp:free via OpenRouter
  • Parser Function: Enforces JSON output format:
    {
      "metatitle": "string",
      "metadescription": "string"
    }
    
  • Ensures structured, predictable output for downstream use.

13. Set metatag (HTTP Request to WordPress REST API)

  • Action: Updates the post meta fields (specifically Yoast SEO fields):
    • _yoast_wpseo_title
    • _yoast_wpseo_metadesc
  • Authentication: HTTP Basic Auth (secure access to protected endpoints).
  • Content-Type: application/json

14. Finish work (Final Google Sheets Update)

  • Updates: Final METATITLE and METADESCRIPTION values in the same row.
  • Completes Loop: Full round-trip from idea → draft → enriched draft → documented result.

Supporting Nodes: Sticky Notes

  • Provide clear documentation across the canvas.
  • Explain phases such as “Fetch context”, “Create draft”, “Upload image”, etc.
  • Improve readability and maintainability.

Step-by-Step Workflow Logic

Here's how the workflow executes step by step:

  1. Start: User triggers the workflow manually.
  2. Read Input: Retrieves a row from Google Sheets containing the PROMPT (topic).
  3. Prepare Context: Stores the prompt in a usable variable.
  4. Generate Article: AI writes a full HTML article based on the prompt.
  5. Generate Title: AI creates a short, SEO-optimized title.
  6. Publish Draft: New draft post created in WordPress with title and article.
  7. Generate Cover Image: AI generates a realistic photo based on the title.
  8. Upload Image: Binary image sent to WordPress media library.
  9. Assign Featured Image: Uploaded image linked to the post as featured media.
  10. Update Google Sheet: Logs basic post info (URL, ID, date, title).
  11. Analyze for SEO: SEO Expert node analyzes the article and generates meta tags.
  12. Parse Output Structurally: Gemini model extracts clean metatitle and metadescription in JSON.
  13. Apply Meta Tags: Updated via WordPress REST API using HTTP PUT request.
  14. Finalize Tracking: Final metadata written back to Google Sheet.

All actions are chained so downstream nodes wait for upstream completion. Parallel execution is avoided to ensure consistency.


Use Cases and Benefits

✅ Ideal For:

  • Content agencies scaling client blogs
  • Solo bloggers maintaining consistent publishing schedules
  • SEO teams needing standardized, optimized content
  • Developers building AI-driven CMS workflows

💡 Key Benefits:

Benefit Explanation
Time Savings Reduces hours of writing, editing, and optimizing to minutes.
Consistency Every post follows the same structural and SEO standards.
Scalability Can process hundreds of topics by simply adding rows to Google Sheet.
Integration Flexibility Built on n8n — easily extendable to Slack, email, Notion, databases, etc.
Data Centralization Google Sheet acts as audit log and editorial calendar.
Yoast SEO Ready Auto-populates critical Yoast fields, improving SEO score from day one.

Conclusion

This n8n workflow represents a cutting-edge approach to modern content operations. By combining AI-generated content, automated media handling, and intelligent SEO optimization, it transforms what used to be a multi-step, human-intensive process into a single-click operation.

With proper credential setup (Google Sheets, WordPress, DeepSeek/OpenAI, OpenRouter), this template becomes a powerful engine for producing professional-quality blog drafts at scale — all while maintaining strict adherence to SEO best practices and content quality standards.

How to use: download the JSON, then in n8n choose “Import from File”.