n8n

How to Automate WordPress Post Categorization?

Use AI to tag your WordPress posts with the right categories in minutes. Great for content teams that need to organize old posts or clean up a messy blog. The goal is fast, consistent categories without manual work.

You start the run by clicking execute. The flow pulls all posts from WordPress, sends each title to an AI Agent that uses the OpenAI Chat Model, and asks for the correct category IDs. The agent returns a simple list of IDs. A WordPress update step then writes those IDs back to each post. You control the prompt so the agent follows your category list. If your site has many posts, you can switch off return all and run smaller batches.

Set up categories in WordPress first and note their IDs. Connect your WordPress and OpenAI accounts, then edit the agent prompt to map your category names to the correct IDs and the response format. Expect to move from hours of manual tagging to a few minutes for dozens of posts, with fewer mistakes. This is ideal for content audits, blog migrations, and large cleanups where speed and consistency matter.

What are the key features?

  • Manual trigger lets you run safe tests before bulk changes.
  • Get all WordPress posts with a return all option for full exports or batch runs.
  • OpenAI Chat Model powers the AI Agent to choose the best fitting categories.
  • Agent returns category IDs only, ready for the WordPress update step.
  • WordPress update maps postId from the source item and writes categories from the agent output.
  • Editable system prompt so you define category names, IDs, and the exact response format.
  • Secure credentials for WordPress and OpenAI stored in n8n.

What are the benefits?

  • Reduce manual work from about 4 hours to about 2 minutes for 80 plus posts.
  • Automate up to 100 percent of category tagging for bulk updates.
  • Reduce tagging errors by about 80 percent with consistent ID mapping.
  • Handle large libraries by running in batches when needed.
  • Connect WordPress and OpenAI in one flow for faster updates.

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with WordPress and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. Open the WordPress nodes in n8n and in the Credential to connect with field click Create new credential, then follow the on screen steps to connect your WordPress site. Give the credential a clear name so you can reuse it later.
  4. Open the OpenAI Chat Model node and click Create new credential. Generate an API key in your OpenAI account, paste it into n8n, name the credential, and save.
  5. In your WordPress admin, make sure all target categories already exist. Open each category edit screen and note the category ID from the URL.
  6. Open the AI Agent node and edit the system prompt. List your category names with their IDs and require the model to return only the IDs, separated by commas, with no extra text.
  7. Open the Get All WordPress Posts node and check Return All. If you see timeouts or want to test small batches, turn Return All off and set a reasonable limit.
  8. Open the WordPress Update node and confirm operation is Update, postId uses the expression from Get All WordPress Posts item id, and the Categories field maps to the agent output value.
  9. Click Execute Workflow to test. Inspect the AI Agent output and confirm it returns only numeric category IDs for each item.
  10. Run a small batch first. Verify a few posts in WordPress to confirm categories changed as expected.
  11. Troubleshoot as needed: if updates fail, check WordPress user permissions. If outputs include text, tighten the prompt to return only numbers. If results are off, reduce the category list or adjust instructions to improve accuracy.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

WordPress

Sign up

Free plan: $0 / mo (WordPress.com REST API supports creating posts)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.