Building An Automated WordPress Publishing Pipeline with n8n and Claude

Some links in this article are affiliate links to products I actually use. If you sign up through them, I may earn a small commission — at no extra cost to you.
I kept putting off writing blog posts because the friction between idea and published article felt too much — a lot of writing, SEO optimisation, image selection. It was always a familiar pattern of initial enthusiasm followed by… nothing. So I automated it.
The result is a n8n workflow (available for free from the official n8n template library via the link at the bottom of this page), for an automated WordPress publishing pipeline with n8n and Claude. It takes a description of the article as input and produces a complete SEO-optimised WordPress draft post using Claude, Google Imagen 4, and the WordPress REST API.
What the Workflow Actually Does
The system handles the complete publishing pipeline. You send a brief description of the desired article via webhook, and it orchestrates several AI and API calls to produce a draft post in WordPress that’s ready to be reviewed and published. Here is what happens behind the scenes:
First, it generates the article content using your specified tone guidelines and a detailed style guide that you configure upfront to match your site and natural voice preferences.
Next, it handles the technical publishing requirements. The workflow generates appropriate tags based on the content, creates SEO metadata, and optionally generates a featured image, with both filename and alt text automatically derived from the article’s focus keyword. Everything gets formatted for WordPress, including heading structures and meta descriptions.
Finally, it publishes directly to your WordPress site via the REST API and configures Rank Math SEO settings automatically. An optional Slack notification confirms the publication with a direct link to the new post.
Setting Up the Components
The workflow requires several API connections before it becomes functional. You will need to have valid access credentials for the following services, and link them to the appropriate nodes:
- Anthropic Claude
- Google AI Studio for Imagen 4 (optional, accessed through the Gemini API)
- WordPress Application Password (with publishing permissions) for REST API access
- Slack OAuth (optional, if you want notifications).
It’s important to note that the generated article is pure HTML – raw content with structured headings is enough – since we can then leverage the full suite of WordPress functionality (using core, theme and plugin features) to control things like formatting and styling, automatically including a table of contents, adding author details etc.
Core Configuration
The CONFIG node in n8n holds your key settings. WORDPRESS_URL is your site’s base URL without trailing slashes. AUTHOR_ID is the WordPress user ID that the draft should appear to be created by—check the users page in wp-admin. DEFAULT_CATEGORY_ID determines where posts land if you don’t specify otherwise. SLACK_CHANNEL is optional but useful for notifications. ENABLE_IMAGE_GENERATION lets you toggle image creation on and off. IMAGE_STYLE_PROMPT defines your visual style. WEBHOOK_SECRET secures your endpoint. TONE_GUIDE and STYLE_GUIDE shape how Claude writes.
Customising Your Voice
The tone and style configuration is where you define your writing voice, structure preferences, and content guidelines. It’s worth refining these prompts because they directly determine output quality and make the result appear more natural.
Include sentence structure preferences, vocabulary choices, things to avoid, and specific formatting rules. The more specific you are about your voice, the better the output. Don’t just say “write clearly”—explain what clarity means to you.
An explicit feature is the optional tone_guide and style_guide parameters. Instead of always hardcoding the same writing style into the workflow, different voices can be specified for different articles.
To create a starting point for your own tone guide, combine a few examples of your existing writing with a prompt like:
"Analyse these writing samples and describe the tone, style, and structural patterns in detail. Focus on sentence structure, vocabulary choices, how technical concepts are explained, and the relationship with the reader."
Security Setup
For API security, enable webhook authentication (Header/JWT/Basic Auth), or else for manual / simpler scenarios the workflow can optionally validate incoming requests against a shared secret.
For this option, set WEBHOOK_SECRET to a long random string, then include it when triggering the workflow. The validation happens early in the flow, before any expensive API calls execute. Without the correct token, the workflow rejects the request. This isn’t production-grade security, but it keeps casual bots and mistake requests out.
Image Generation Toggle
Featured image generation can be enabled or disabled through a simple boolean switch in the workflow configuration. When enabled, the system extracts key concepts from your article and generates a prompt (prefixed with IMAGE_STYLE_PROMPT) to create a featured image for the post.
The prompt for the image is generated by the model, which is fine in normal operation but should be validated if the article brief can be compromised.
WordPress SEO Integration
WordPress’s REST API handles most of the work, but since it doesn’t expose custom meta fields by default, Rank Math SEO requires a custom endpoint registration. I added a simple mu-plugin called rank-math-rest.php that registers the necessary meta fields for setting the focus keyword, SEO title, and meta description to the post endpoint via REST API. Add this file to your wp-content/mu-plugins/ folder and WordPress will load it automatically.
<?php
/**
* Register Rank Math SEO meta fields for REST API access.
* Required for n8n workflow to set SEO data via WP REST API.
*/
add_action( 'rest_api_init', function () {
$fields = [
'rank_math_focus_keyword',
'rank_math_title',
'rank_math_description',
];
foreach ( $fields as $field ) {
register_post_meta( 'post', $field, [
'show_in_rest' => true,
'single' => true,
'type' => 'string',
'sanitize_callback' => 'sanitize_text_field',
'auth_callback' => function () {
return current_user_can( 'edit_posts' );
},
] );
}
} );
The plugin uses the WordPress register_post_meta function to make the meta fields readable and writable through API calls. This is entirely optional, but without this, the SEO metadata won’t be saved when a post is created.
As a brief aside, it’s possible to skip this step by configuring your SEO plugin to extract meta title and description from the post title and excerpt, however setting these explicitly allows more control to fit within the shorter character limits for meta fields.
Triggering the Publication Process
The simplest trigger method is direct HTTP POST requests to the webhook at /webhook/article-publisher. I use Claude or a simple web form for ad-hoc triggering, but the real power comes from integrating with other automation and/or scheduling workflows (e.g. to send requests based on defined input triggers or at predetermined times).
The complete publishing process can take up to a couple of minutes, depending on content complexity and image generation settings – most of this time comes from the AI model processing and image generation.
On completion, the Slack notification includes the article title, identifies tools where affiliation opportunities would be possible, and adds a direct link to the post. This can integrate with existing team communication flows or be disabled or replaced if you already have another mechanism for coordinating draft post reviews and publication within your team.
Limitations
It produces content based on your brief and the model’s training data. As with all things AI, human oversight remains essential, which is why the posts are explicitly created as drafts. Content quality can vary. Some articles need significant editing, others are more publish ready. The system works best for well-defined content types and there is a limit of 4,000 output tokens per article which can be increased for complex topics.
The current workflow does not handle content research or fact-checking, although I’m currently testing another version that create a “newsroom” by combining different AI models (Claude, Mistral, OpenAI and Gemini) to incorporate these features and determine the effect that this approach has on quality, although this will impact the cost per article in API fees.
Try It Yourself
The workflow can be run either self-hosted or on the n8n Cloud.
Even if you don’t use the same setup, the concept is worth exploring. What barriers stop you from publishing consistently? What could you automate to lower that friction? The specific tools matter less than identifying and systematically removing the obstacles that derail your momentum. Start small, iterate, and remember that a working imperfect system beats a perfect imagined one every time.
The workflow won’t write better than you can. But it might help give a starting point, and sometimes that’s exactly what you need.


