Auto Categorize WordPress Posts with n8n and AI

Discover how to automatically categorize 82 WordPress blog posts in just 2 minutes using an n8n workflow combined with OpenAI’s AI language model. This automation streamlines content organization by assigning precise categories based on post titles, saving hours of manual work and minimizing errors.
wordpress
agent
lmChatOpenAi
+2
Workflow Identifier: 1677
NODES in Use: Manual Trigger, WordPress, Sticky Note, AI Agent, OpenAI Chat Model

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 Automation Does

This n8n workflow automatically sorts blog posts by category on a WordPress site. It stops the need for manual sorting and reduces mistakes by assigning a single relevant category based on the post title.

The workflow fetches all posts, sends titles to AI for category selection, and updates posts with the chosen category, saving hours of manual work.


Tools and Services Used

  • WordPress REST API: Provides access to blog posts and allows updating post categories.
  • OpenAI API: Processes post titles to determine best category using a custom prompt.
  • n8n Workflow Automation Platform: Links WordPress and OpenAI nodes and manages task automation.

Input → Process → Output

Inputs

  • All existing WordPress posts retrieved via the WordPress node.
  • Each post’s title text is input for AI categorization.

Processing Steps

  • n8n fetches every post with WordPress API.
  • The AI Agent node sends a prompt with post title to OpenAI.
  • AI returns the single best category ID from a fixed category list.
  • The workflow updates each post’s category in WordPress using the returned ID.

Output

  • All WordPress posts have an updated primary category set accurately.
  • The user saves over 3 hours weekly on manual post sorting.

Beginner Step-by-Step: Using This Workflow in n8n

Importing the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open the n8n editor you already use.
  3. Click on Import, then choose “Import from File” to add the workflow into n8n.

Configuring Credentials

  1. Add your WordPress API credentials in the WordPress nodes.
  2. Insert your OpenAI API key in the AI Agent node credentials.
  3. Check and update category IDs in the AI Agent prompt if changes apply.

Testing and Activation

  1. Run the workflow once using the Manual Trigger node “Execute Workflow” button to verify it works.
  2. Confirm categories update correctly in your WordPress admin panel.
  3. Activate the workflow within n8n to use it in production.
  4. Optionally set schedule or manual triggers as needed.
  5. Consider self-host n8n if running on your own server.

Common Issues and Fixes

401 Unauthorized Errors

Check WordPress API credentials in n8n. Make sure API keys have permission to access posts.

AI Agent Returns No or Wrong Category

Make sure AI prompt text is copied exactly. Verify OpenAI API key is active and valid.

Posts Not Updating

Double-check dynamic expressions used for postId and categories fields. IDs must match WordPress post data and AI output format.


Customization Ideas

  • Change the category list in AI prompt to your own taxonomy.
  • Limit how many posts run by adjusting the WordPress getAll node.
  • Modify AI prompt to return category names if preferred and change update node mapping accordingly.

Summary of Benefits

✓ Saves time by automating post categorization.
✓ Reduces errors from manual sorting.
✓ Improves site navigation with consistent categories.
✓ Works fast on 80+ posts in minutes.
✓ Easy to run and customize inside n8n.


Frequently Asked Questions

The workflow fetches posts, sends titles to OpenAI AI Agent node with a prompt, receives a category ID, then updates each post’s category accordingly.
Users must have WordPress API credentials, an OpenAI API key, and access to an n8n editor to import and configure the workflow.
Yes, the category list is set in the AI Agent node prompt and can be edited to match custom WordPress categories.
Incorrect or missing WordPress API credentials cause 401 errors. Check and reenter credentials in the WordPress nodes.

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