🤖✨ Create & Publish Blog Posts Automatically Using n8n, ChatGPT & WordPress!

4 min read 7 months ago
Published on Aug 31, 2025 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial will guide you through the process of automatically creating and publishing blog posts using trending news, OpenAI's ChatGPT, and WordPress, all powered by n8n automation. Whether you're a blogger, content marketer, or just interested in automation, this step-by-step guide will help you set up a no-code system that runs hands-free every day.

Step 1: Set Up WordPress Credentials and API Access

To begin, you need to configure your WordPress site for API access.

  • Create a WordPress User:

    • Go to your WordPress dashboard.
    • Navigate to Users > Add New.
    • Create a user with Administrator privileges for API access.
  • Enable REST API:

    • Ensure that your WordPress installation has the REST API enabled (it usually is by default).
  • Generate Application Password:

    • On your WordPress user profile, scroll to the Application Passwords section.
    • Generate a new application password and save this, as you will need it for authentication in n8n.

Step 2: Schedule Your Daily Automation

Next, you will set up a schedule in n8n to automate the process.

  • Open n8n: Access your n8n instance.
  • Create a New Workflow: Click on "New Workflow."
  • Add Trigger Node:
    • Use the Cron node for scheduling.
    • Set it to run daily at your preferred time.

Step 3: Fetch Trending News via API

Now, you will retrieve the latest news to base your blog posts on.

  • Use NewsData API:
    • Sign up for access to the NewsData API.
    • Add the HTTP Request node in n8n.
    • Set it to fetch trending news articles using the appropriate endpoint and your API key.

Step 4: Generate Blog Content with ChatGPT

Transform the news headlines into engaging blog content using ChatGPT.

  • Add OpenAI Node:

    • In n8n, connect to the OpenAI node.
    • Input the fetched news headlines as prompts for content generation.
  • Configure Parameters:

    • Set parameters for response length and creativity (temperature).
  • Process Output:

    • Parse OpenAI’s JSON output to extract the generated text.

Step 5: Generate an AI Image with ChatGPT

Enhance your blog post with relevant images.

  • Create Image with OpenAI:

    • Use another OpenAI node to generate an image based on your blog content.
  • Output Handling:

    • Capture the image URL from the response for later use.

Step 6: Resize Image for Blog Formatting

Ensure that your images fit well within your blog layout.

  • Add Image Resizing Node:
    • Use the Image node in n8n to resize the image to your desired dimensions.

Step 7: Upload Image to WordPress

Upload the generated image to your WordPress media library.

  • Use HTTP Request Node:
    • Set up an HTTP Request node to upload the image.
    • Authenticate using the username and application password created earlier.
    • Specify the endpoint for media uploads and include the resized image.

Step 8: Merge Article and Image

Combine the generated blog content with the uploaded image.

  • Prepare Payload:

    • Construct a payload that includes your blog text and the image ID from the upload response.
  • Create Post Data:

    • Format the data according to WordPress requirements.

Step 9: Publish the Blog Post via WordPress REST API

Finally, publish your blog post on your WordPress site.

  • Use HTTP Request Node:
    • Set up another HTTP Request node to publish the post.
    • Authenticate and specify the correct endpoint for post creation.
    • Include the merged content in the request body.

Step 10: Test the Workflow Live

Ensure everything works as expected.

  • Execute the Workflow:
    • Run the workflow manually to test each step.
    • Check your WordPress site to confirm the blog post has been published successfully.

Conclusion

You have now created an automated system that fetches trending news, generates blog content and images, and publishes posts directly to WordPress using n8n, ChatGPT, and the WordPress REST API. This setup allows you to produce content hands-free on a daily basis, saving you time and effort. For further improvements, consider customizing prompts for ChatGPT or enhancing the image generation process.