n8n

How to Automate WordPress SEO Content Publishing?

Publish SEO focused WordPress articles on a set schedule. The system balances topics by choosing the least used category and writes a complete post with a cover image. It suits marketing teams and agencies that need steady output without heavy manual work.

On each run a schedule trigger starts the flow. It reads WordPress categories, filters any you exclude, then queries PostgreSQL to see which categories were used recently. The flow picks the least used category, pulls around ten recent titles for context, and asks OpenAI to propose a fresh title and SEO headings. A second OpenAI step writes the full article with clear sections and a suggested image. The image is downloaded, uploaded to WordPress Media, and all content is merged. A JSON payload is built and published to the WordPress posts endpoint, and the database is updated to track usage.

Setup needs WordPress REST access with rights to create posts and media, an OpenAI key, and a PostgreSQL database with the provided used categories table. You also set a DOMAIN variable for all API calls. Expect hours saved each week, consistent posting, and even coverage across categories. It fits niche blogs, multi author sites, and agencies running content calendars for several clients.

What are the key features?

  • Schedule trigger runs the content pipeline every few hours
  • Loads WordPress categories and filters out any you choose to exclude
  • Tracks category usage in PostgreSQL to avoid over posting the same topic
  • Selects the least used category for the next article
  • Checks recent titles to reduce duplicates and thin content
  • Two stage AI generation using OpenAI for titles and SEO headings, then full article
  • Downloads the suggested cover image and uploads it to WordPress Media
  • Merges title, content, image, and category into a single post object
  • Prepares a clean JSON payload and publishes via the WordPress posts endpoint
  • Writes back to the database to record the publish event

What are the benefits?

  • Reduce manual writing and publishing time from 3 hours to 10 minutes per post
  • Automate about 90 percent of repetitive content work
  • Keep categories balanced by always picking the least used topic
  • Lower copy paste errors by 95 percent through direct API publishing
  • Connect WordPress, OpenAI, and PostgreSQL in one flow
  • Scale to several posts per day without adding staff

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, OpenAI and PostgreSQL. See the Tools Required section above for links to create accounts with these services.
  3. Create the WordPress credential: double click the Media Upload to WP or Post to WP node, choose the credential dropdown, click Create new credential, then follow the on screen steps to connect your site with a user that can create posts and media.
  4. Create the OpenAI credential: double click each OpenAI Chat Model node, click Create new credential, paste your API key from the OpenAI account API page, and save.
  5. Prepare PostgreSQL: run the provided SQL from the workflow notes to create the database and the used_categories table. In n8n, create a PostgreSQL credential named YOUR_POSTGRES_CREDENTIAL with the host, port, database, user, password, and schema values you set.
  6. Open the Config node and set the DOMAIN value to your WordPress site URL, for example https://your site dot com.
  7. Open the Category Filter settings and add any category IDs you want to exclude from AI generated posts.
  8. Assign credentials: ensure Selecting recent, 10 latest headlines, and Updating posts DB use YOUR_POSTGRES_CREDENTIAL. Ensure Media Upload to WP and Post to WP use your WordPress credential.
  9. Test the first steps: run from the schedule trigger into Load Categories and Category Filter to confirm categories load. Then run the database nodes to confirm reads and writes. Check that OpenAI nodes return a title, headings, and content.
  10. Validate publishing: run the full flow once and confirm a new post appears in WordPress with the correct category, content, and cover image. If the image fails, check the Placeholder creator and the Download Image node logs.
  11. Troubleshoot common issues: if WordPress returns 401 or 403, verify the user role and credential. If PostgreSQL fails to connect, check host, port, and grants. If OpenAI errors, verify the API key and selected model.
  12. Enable the Schedule Trigger and set the interval in hours to match your publishing plan. Save and activate the workflow.

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

PostgreSQL

Sign up

Free: $0 (open-source PostgreSQL License; self-hosted)

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.