Are you tired of manually optimizing every blog draft for SEO, engagement, and content freshness? This comprehensive guide will show you how to build an effective n8n WordPress automation that streamlines your entire content optimization process using n8n, WordPress, and the Perplexity AI node — even adding a featured image if one’s missing!
Manual optimization can be time-consuming and repetitive. Additionally, staying current with SEO best practices requires constant attention. However, automation eliminates these challenges completely. Furthermore, this step-by-step tutorial demonstrates how to fully automate the process using n8n, WordPress, and the Perplexity AI node.Manual optimization can be time-consuming and repetitive.
Additionally, staying current with SEO best practices requires constant attention. However, automation eliminates these challenges completely. Furthermore, this step-by-step tutorial demonstrates how to fully automate the process using n8n, WordPress, and the Perplexity AI node — even adding a featured image if one’s missing! Manual optimization can be time-consuming and repetitive. In this post, I’ll walk you through how to fully automate the process using n8n, WordPress, and the Perplexity AI node — even adding a featured image if one’s missing!
Whether you’re a content marketer, SEO professional, or tech-savvy blogger, this n8n WordPress automation will save you hours of work every week. For more automation guides, check out our WordPress automation tips. Whether you’re a content marketer, SEO professional, or tech-savvy blogger, this no-code automation will save you hours of work every week.
✅ What This Workflow Does
This n8n workflow will:
- Fetch the oldest draft post from your WordPress site.
- Extract the title, excerpt, meta description, and content.
- Use Perplexity AI to rewrite the post for SEO optimization, engagement, and updated information.
- Automatically add a featured image if none exists.
- Back up the original post before making any changes.
- Update the original draft with the optimized content.
🧩 Tools and Accounts You’ll Need
Tool | Purpose |
---|---|
WordPress | CMS where your draft blogs are stored |
n8n | No-code automation platform |
Perplexity AI | For rewriting and enriching your content |
Unsplash API (optional) | For fetching featured images |
Google Drive / Sheet (optional) | For backing up original content |
🔒 Prerequisites
Before you start, make sure:
- Application Passwords are enabled in your WordPress account.
- You have a valid Perplexity AI API key and credentials set in n8n.
- You’ve set up WordPress credentials in n8n using your username and application password.
- Your WordPress installation supports REST API (default for most setups).
🛠️ Step-by-Step: Create the Workflow in n8n
Step-1: Trigger the Workflow
Use a Schedule Trigger or Manual Trigger to initiate the workflow.
Step-2: Fetch the Oldest Draft Post
- Node: WordPress (Operation: Get All Posts)
- Parameters:
status
:draft
order
:asc
orderby
:date
limit
:1
- Output: Single draft post with all post metadata
Step-3: Back Up the Original Post
- Node: Google Sheets or File Storage
- Content to Back Up:
- Post ID
- Title
- Excerpt
- Meta Description (if available)
- Content
- Date/time of backup
📌 Tip: You can also create a duplicate post in WordPress with a _backup
suffix.
Step–4: Prepare the SEO Prompt
- Node: Set or Function
- Prompt Template:
Rewrite the following blog post to be more SEO-optimized, engaging, and include the latest information.
Title: {{ $json["title"] }}
Excerpt: {{ $json["excerpt"] }}
Meta Description: {{ $json["meta_description"] }}
Content:
{{ $json["content"] }}
Step–5: Use Perplexity AI to Optimize
- Node: Perplexity (Message a Model)
- Input: Prompt created above
- Model: Use GPT-4 or Claude-based models supported by Perplexity
- Output: Optimized title, excerpt, content (may require parsing)
Step-6: Check & Add Featured Image (If Missing)
- Condition:
featured_media === 0
- If missing:
- Node: HTTP Request (GET from Unsplash)
https://api.unsplash.com/photos/random?query={{ keyword }}&client_id={{ UNSPLASH_API_KEY }}
- Node: HTTP Request (POST to WordPress media endpoint)
- Upload the downloaded image
- Save the
media_id
for updating the post
- Node: HTTP Request (GET from Unsplash)
Step 7: Update the WordPress Draft
- Node: WordPress (Operation: Update Post)
- Inputs:
- Post ID: from Step 2
- Title, Content, Excerpt: from Perplexity output
- Featured Media: new media ID (if updated)
- Status:
Publish
(Change it to Publish to stop it from repeated auto Edit)
- Optional: Update custom fields or metadata for plugins like Yoast or Rank Math (may require additional REST calls)
🔄 Optional Enhancements
- Slack/Email Notification: Send confirmation once the post is updated.
- Image Relevance Check: Use a prompt to generate image keywords from content.
- Multiple Post Handling: Loop through multiple draft posts in batches.
⚙️ Error Handling Tips
- Always check if Perplexity’s response is complete. Use
IF
orFunction
nodes to handle empty outputs. - In case of API failure (e.g., Unsplash limit), retry with alternate services or use a fallback image.
- Keep logs of updated posts and backups with timestamp.
💡 Why This Automation Works
- Automates content enhancement without human intervention.
- Keeps blog content SEO-friendly and current using the latest AI insights.
- Saves content managers hours of repetitive work.
- Ensures zero data loss with automated backup.
📈 Final Thoughts
With this n8n + Perplexity + WordPress automation in place, your blog drafts will stay sharp, search-optimized, and always ready to go live. And best of all, the workflow runs on autopilot.
Start automating your content refinement today and focus on what truly matters — growing your audience and impact.