AI Content Generation and Scheduled WordPress Publishing - n8n Workflow

Use this powerful n8n workflow to automate AI content creation (GPT-4o), schedule randomized publishing delays, retrieve Pexels images, and publish directly to WordPress. Explore advanced n8n templates.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content Managers and SEO Specialists needing high-volume, automated content pipelines.

  • Bloggers and Marketers looking to maintain consistent publishing schedules without manual effort.

  • Users seeking advanced examples of an n8n workflow combining AI, scheduling, and CMS integration.

  • Technical users interested in customizing sophisticated n8n templates.

Overview

This comprehensive content automation pipeline utilizes the flexibility of n8n to manage the entire article lifecycle, from inception to publication. The n8n workflow addresses the challenge of bulk content creation by integrating advanced AI capabilities (GPT-4o) to generate structured, SEO-optimized articles and associated image search keywords. Critically, the workflow employs a randomized delay before processing, ensuring a natural, unpredictable publishing pattern, unlike standard scheduled posts. By automatically retrieving relevant images via the Pexels API and formatting the content for immediate publishing via the Wordpress n8n node, this n8n template drastically reduces the time and effort required to run a high-volume content operation.

How it Works

This powerful n8n workflow is initiated by the active 3. Schedule Your Posts n8n trigger, which is set to run three times a week. The flow immediately proceeds to the Processing Delay n8n node, which calculates a random waiting period (0 to 6 hours) to randomize the exact publication time. This calculated duration is implemented by the Random Wait n8n node.

Once the delay completes, the Generate AI Content n8n node (using GPT-4o) executes a specific prompt, mandating the output of the title, HTML content, and a list of image keywords in a strict JSON format. This structured output is vital for the subsequent steps in the n8n workflow.

Next, the Save to Sheet n8n node logs all the generated data (title, content, and combined keywords) into a Google Sheet for logging and tracking. The flow then moves to the Automated Image Retrieval from Pexels n8n node (an HTTP Request n8n node), which uses the AI-generated keywords to query the Pexels API and fetch a suitable image URL.

Finally, the Create posts on Wordpress n8n node takes the article title and formats the post content by embedding the retrieved Pexels image at the beginning, followed by the AI-generated HTML article body. The n8n workflow then publishes the new post immediately, completing the automated content cycle.

Installation Guide

To implement this n8n template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' -> 'Import from JSON' option.

  2. Configure Credentials: You must update the credentials for the following n8n nodes:

OpenAI: Set up credentials for the Generate AI Content n8n node.
Google Sheets: Set up OAuth2 credentials for the Save to Sheet n8n node and update the Document ID.
Pexels API Key: In the Automated Image Retrieval from Pexels n8n node, replace YOURPEXELSAPI_KEY in the Authorization header with your actual key.
Wordpress: Set up API credentials for the Create posts on Wordpress n8n node.

  1. Customize the Prompt: Update the prompt within the Generate AI Content n8n node with your specific topic requirements. Ensure the prompt maintains the required final JSON structure for the n8n workflow to function correctly.

  2. Activate the n8n Trigger: Ensure the 3. Schedule Your Posts n8n trigger is enabled and configured to your desired schedule (currently Tues, Thurs, Sun at 12 PM).

  3. WordPress Setup (Recommended): Install and enable the 'Featured Image from URL (FIFU)' plugin on your WordPress site, and set it to automatically grab the featured media from the post content.

Node Details


  • 3. Schedule Your Posts (Schedule Trigger n8n trigger):

- Function: Initiates the n8n workflow on a predefined schedule (Tuesdays, Thursdays, and Sundays at 12 PM).
- Key Configuration: Uses a time-based rule to control execution timing.

  • Processing Delay (Code n8n node):

- Function: Executes custom JavaScript to generate a random delay duration between 0 and 6 hours. This adds variability to the publication schedule.
- Key Configuration: const delay = Math.floor(Math.random() (6 60 60 1000));

  • Random Wait (Wait n8n node):

- Function: Pauses the execution of the n8n workflow for the random duration calculated by the previous code n8n node.
- Key Configuration: Amount is dynamically set using expression: {{$json["delay"] / 1000}} (in seconds).

  • Generate AI Content (OpenAI n8n node):

- Function: Uses GPT-4o to generate a full article, including the title, HTML-formatted content, and 3-5 image search keywords, enforcing a strict JSON output structure.
- Key Configuration: Model set to gpt-4o; JSON Output is enabled.

  • Save to Sheet (Google Sheets n8n node):

- Function: Appends the generated AI content (title, HTML, and joined keywords) to a Google Sheet, serving as a log or content inventory.
- Key Configuration: Operation set to Append; values are mapped from the AI output.

  • Automated Image Retrieval from Pexels (HTTP Request n8n node):

- Function: Queries the Pexels API for a relevant landscape image using the keywords generated by the AI.
- Key Configuration: Uses the Image search keyword data from Google Sheets in the query parameter and requires an Authorization header containing the Pexels API Key.

  • Create posts on Wordpress (Wordpress n8n node):

- Function: Publishes the final article to the connected WordPress site.
- Key Configuration: Status set to publish. Content is constructed using dynamic expressions, embedding the Pexels image URL () followed by the main article body.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by
Sunny
Sunny

Luxury Brand Storyteller meets AI Innovation. Helping brands craft unforgettable narratives.

Featured*