Skip to content

How to Automate WordPress Tasks with n8n, Step by Step

A practical guide to connecting n8n to a WordPress site through the REST API and application passwords, then building real automations: scheduled publishing and social media reposting, comment monitoring and spam filtering, backup and update alerts, site downtime monitoring, form collection and content sync — with fixes for authentication and webhook errors.

Automationعمر فتحي32 min read
Illustration of a website window connected to calendar, gear and code workflow nodes with an access key, representing website task automation
On this page

WordPress is an excellent platform, but a lazy one: it doesn't remind you of a missed backup, doesn't tell you that a critical plugin has a security update, doesn't publish your post to your channels, and doesn't alert you when the site goes down at three in the morning. Today all these gaps are filled either by repetitive manual work or by a pile of plugins, each adding queries and load on the server. n8n solves the problem from the outside: an independent automation server that talks to your site through its API, so it adds no weight to WordPress and doesn't interfere with its performance.

This guide is applied specifically to WordPress. If you are new to the tool itself, start with the guide to automation with n8n from scratch to understand nodes and workflows, the guide to installing n8n on a VPS to run your own instance, and the n8n integrations guide to understand how credentials and authentication work in general. Here we will assume n8n is already running for you and focus on the one thing none of those guides explains: how to bend WordPress specifically to your will.

The WordPress–n8n integration cycleTwo directions: an event out of the site, a command inWordPressThe site/wp-json/wp/v2Automation usern8nWorkflowNodes + conditionsCredentials① WebhookPost · comment · formREST API · app password② Create / updateOutputsTelegram · SlackGoogle Sheets · emailInstant alert and logBeware the infinite loopPublishing from n8n fires the publish webhook — stop it with IFThe rule: a dedicated user with least privilege, keys in Credentials, not inside nodes
The two-way integration cycle: an event leaves WordPress via a webhook to n8n, and a command comes back from n8n to the site via the REST API with an application password — and the keys live in Credentials, not inside the nodes.

How does n8n talk to WordPress in the first place?

Everything you see in the WordPress dashboard — creating a post, approving a comment, editing a user — has a counterpart in the REST API. When you open the editor and click "Publish," the dashboard itself sends a POST request to /wp-json/wp/v2/posts. n8n does nothing magical: it sends the same request, but from the outside and with explicit authentication.

The standard path is https://example.com/wp-json/wp/v2/<resource>. Try it now in your browser: open https://yoursite/wp-json/ — if you see a long block of JSON describing the API, the path is open and the connection is possible. If you see a 404 or an "unauthorized" page, you have hit the most common obstacle, which we will come back to in the troubleshooting section.

There are three ways to build the connection, and each has its proper place:

MethodWhat it coversWhen to choose itLimitation
The built-in WordPress nodePosts, pages, users: create/get/updateCommon operations on content — the fastest, clearest setupDoesn't cover comments, categories, media or plugins
The HTTP Request nodeAny endpoint under /wp-json/ with any method (GET/POST/DELETE)Comments, media, custom fields, plugin endpoints (such as WooCommerce)You write the path and payload by hand and read the documentation
Webhook (WordPress > n8n)Receiving events the moment they happenA post is published, a new comment, a form submission, a purchase orderRequires n8n to be reachable from the internet over HTTPS

The practical rule: start with the WordPress node if the operation is within its scope, and switch to HTTP Request as soon as you hit the first thing outside it. Don't waste time trying to force the built-in node to do what it wasn't built for — switching to HTTP Request is not a defeat, it is the natural way to use the tool.

An important point that is often stated wrongly: there is no official "WordPress Trigger" node in n8n. The WordPress node is an action node only. Any talk of "n8n watching your site automatically" means either a webhook you send from WordPress or scheduled polling in which you query the API every few minutes. Know the difference from the start and save yourself an hour of searching.

How do you create an application password and connect it to n8n?

Application passwords are a feature built into WordPress core since version 5.6, and they are what made external integration safe and simple. The idea: instead of giving n8n your account password — which opens the entire dashboard and bypasses two-factor authentication — you generate a string dedicated to a single application, valid only for REST API requests, which you can revoke on its own without touching your account.

The steps in the dashboard:

  1. From the WordPress dashboard, go to Users > Add New and create a dedicated automation user, for example named n8n-bot, with a real email address you own.
  2. Give it the lowest role that is enough for its task (see the next table) — don't choose Administrator by default.
  3. Open that user's profile (Users > All Users > Edit) and scroll down to the Application Passwords section.
  4. Type a descriptive name that will later tell you who uses it — such as n8n-publisher — then click Add New Application Password.
  5. The string will appear only once, as twenty-four characters split by spaces. Copy it immediately; you won't see it again, and you will have to generate a replacement if you lose it.

The spaces inside an application password are not a mistake and don't need to be removed; WordPress ignores them during verification, and both keeping and removing them work. The common mistake is copying an extra character or a newline at the end, which is a silent cause of 401 errors.

Now in n8n: open Credentials > New, search for WordPress API, and fill in just three fields — the site URL (without /wp-json), the username and the application password. Click Save, then use the test button if it appears. The credential is stored encrypted in n8n and reused across all the site's nodes.

For a quick check from outside n8n before you build anything, try this request from your terminal:

bash
# Check that the API is open at all (no authentication needed)
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/wp-json/

# Check that the application password works — it should return the user's data
curl -u "n8n-bot:xxxx xxxx xxxx xxxx xxxx xxxx" \
  https://example.com/wp-json/wp/v2/users/me?context=edit

If the first returns 200 and the second returns a JSON object containing "id" and "capabilities", the connection is one hundred percent sound, and any problem that comes up later lies in n8n, not in WordPress. Separating the two sides like this saves you hours of guesswork.

Which role should you give the automation user?

An application password fully inherits its owner's permissions. If you generate it from an administrator account, any leak means full control of the site, including installing plugins. The principle of least privilege here is not cosmetic advice but the first line of defense:

RoleWhat it can do via the REST APIGood forNot good for
SubscriberRead its own profile onlyChecking that the connection is alive, nothing moreAny writing
ContributorCreate drafts of its own posts onlyReceiving content from an external source as a draft for reviewDirect publishing
AuthorCreate, publish and edit its own postsScheduled publishing from an external queueEditing other writers' posts
EditorAll posts, pages and commentsComment moderation, updating existing content, syncingManaging plugins and updates
AdministratorEverything, without exceptionRare cases only: reading plugin and update statusAny routine daily use

The practical order: Author for most publishing automations, Editor for comments and syncing, and Administrator only if you must read the plugin and update endpoints — and in that case make it a separate user with a separate application password dedicated to that workflow alone. If the publishing password leaks, it won't open plugin management, and vice versa. And enable two-factor authentication on all human admin accounts; it doesn't disable application passwords at all.

When should you use a webhook, and when a schedule?

Every workflow starts with a single trigger, and your choice determines how the whole automation behaves: does it respond within the same second, every five minutes, or once a day?

Webhook means WordPress takes the initiative: the event happens, and the site sends a POST request to a unique URL that n8n gives you, so the workflow starts immediately. This is the fastest and cleanest option, but it comes with one strict condition: the n8n server must be reachable from the public internet over HTTPS. If n8n runs on your local machine or behind a closed network, nothing will reach it. For the webhook concept itself, see the Webhook definition in the wiki.

Schedule (Cron) means n8n takes the initiative on a fixed schedule: every five minutes, every hour, every day at eight in the morning. Your server doesn't need to be reachable from outside at all, and that alone makes it the default choice for anything that doesn't need to be instant. The scheduling syntax here is the same familiar cron syntax, and if the five fields confuse you, see the guide to scheduled tasks (cron jobs).

Polling is a special case of Schedule: you periodically ask the API "is there anything new since last time?" and compare against a saved ID or date. It is simpler to set up than a webhook and heavier on resources, but it is the lifesaver when instant delivery isn't possible.

TriggerResponse timeRequires n8n reachable from the internet?Load on the siteGood for
WebhookInstant (seconds)Yes, HTTPS is mandatoryAlmost nothing — one request per eventA post is published, a new comment, a form submission, a purchase order
Schedule / CronPer the scheduleNoZero (n8n does the work)Daily reports, cleanup, scheduled publishing, update checks
PollingPer the interval (5–15 minutes)NoA request every cycle, even if nothing is newComment monitoring, plugin tracking, any source without webhooks

A tip for economy: don't shorten the interval without a reason. Checking comments every minute means 1,440 requests a day to your site to catch two comments. Make the interval proportional to the real cost of a delay — five minutes for comments, fifteen minutes for updates and an hour for reports.

Practical scenarios: how do you actually build them?

This is the heart of the article. Every scenario is built on the same trio: trigger > nodes > result. Build just one of them and you will understand the rest without explanation.

1. Scheduled publishing from an external queue

The problem: you write a batch of posts once a week and want to publish them spread over several days. WordPress's built-in scheduling is enough if the content is inside the site, but it doesn't help if your source is external — a spreadsheet, Notion, or the output of a language model.

  • Trigger: Schedule Trigger daily at 09:00.
  • Node 1: Google Sheets > Get Rows from a sheet with the columns: title, content, category, publish date, status.
  • Node 2: Filter > keep the rows whose status is ready and whose date is today.
  • Node 3: WordPress > Post: Create, mapping Title, Content and Status: publish from the row's fields with {{ }} expressions.
  • Node 4: Google Sheets > Update Row to change the status to published — this node is not a luxury: without it, the same row will be republished every day.
  • Result: a post published every day without intervention, and a clear log of what was published.

The recurring lesson in every writing automation: mark the source as processed. Whether with a status column, a last-processed date or a meta flag — without this step every automation turns into a machine that repeats the same work.

2. Reposting the post on social media the moment it is published

  • Trigger: a Webhook in n8n with the POST method.
  • On the WordPress side: either a webhooks plugin that fires an event on post_published, or a few lines in the child theme's functions.php file:
php
add_action( 'transition_post_status', function ( $new, $old, $post ) {
    if ( $new !== 'publish' || $old === 'publish' || $post->post_type !== 'post' ) {
        return;
    }
    if ( get_post_meta( $post->ID, '_n8n_sent', true ) ) {
        return; // Prevent duplicates
    }
    wp_remote_post( 'https://n8n.example.com/webhook/wp-published-9f3a2b', array(
        'timeout'  => 5,
        'blocking' => false,
        'headers'  => array(
            'Content-Type'  => 'application/json',
            'X-Wp-Secret'   => 'put-a-long-secret-here',
        ),
        'body' => wp_json_encode( array(
            'id'    => $post->ID,
            'title' => get_the_title( $post ),
            'url'   => get_permalink( $post ),
        ) ),
    ) );
    update_post_meta( $post->ID, '_n8n_sent', 1 );
}, 10, 3 );

Note three valuable details here: blocking => false means the request doesn't delay the writer's experience at all, the secret X-Wp-Secret header stops any stranger from triggering your workflow with a forged request, and the _n8n_sent meta flag prevents duplicate sends. Don't put this code in the parent theme's files — it will be wiped with the first update; use a child theme or a small plugin of your own.

The payload n8n receives looks like this:

json
{
  "id": 4821,
  "title": "How to Choose a Hosting Plan That Fits Your Store",
  "url": "https://example.com/choose-hosting-plan"
}
  • Node 1: IF > check that X-Wp-Secret equals the expected secret; otherwise stop the execution.
  • Node 2: HTTP Request > GET /wp-json/wp/v2/posts/{{ $json.id }}?_embed to fetch the excerpt and featured image (the payload is deliberately short so it doesn't bloat).
  • Nodes 3 and 4: an X node and a LinkedIn (or Telegram) node to broadcast the title, excerpt and link.
  • Result: every new post appears on your channels within seconds of being published.

3. Comment monitoring and spam filtering

The WordPress node doesn't cover comments, so this whole scenario runs on HTTP Request — a perfect example of the natural switch between the two methods.

  • Trigger: Schedule Trigger every 5 minutes.
  • Node 1: HTTP Request > GET /wp-json/wp/v2/comments?status=hold&per_page=20&orderby=date&order=desc (requires authentication with the Editor role or higher).
  • Node 2: Filter > exclude what was already processed by comparing id with the last ID saved in a static data node or a side sheet.
  • Node 3: an AI node or a set of conditions > classify the comment: does it contain more than two links? Is it in a language that doesn't suit your audience? Does it match known spam patterns?
  • Node 4 (spam path): HTTP Request > POST /wp-json/wp/v2/comments/{{ $json.id }} with the payload {"status":"spam"}.
  • Node 5 (legitimate path): Telegram > an alert with the comment text and a direct approval link.
  • Result: an automatically clean comment queue, and a human alert only for comments that deserve a reply.

The payload you send to change the status is this simple:

json
{
  "status": "spam"
}

Be conservative in this scenario in particular: give the comment the benefit of the doubt. Deleting a genuine comment from a serious reader is a much bigger loss than leaving a spam comment pending for five more minutes. Start with a "send it to me for review" path for two weeks, watch the classification accuracy, then enable automatic deletion only for the category that has proven fully accurate.

4. Backup and update alerts

  • Trigger: Schedule Trigger daily at 08:00.
  • First branch — updates: HTTP Request > GET /wp-json/wp/v2/plugins (requires plugin management permission, so use the dedicated administrator credential here alone), then a Filter on plugins whose status indicates an available update, then an aggregation node that builds a text list.
  • Second branch — backups: if your backup tool uploads files to external storage, read the file list from there and check that the newest file is less than 24 hours old. If the tool sends an email instead, monitor the mailbox with an IMAP node.
  • Last node: Slack or Telegram > one daily message combining both branches: "3 plugins awaiting updates · last backup 6 hours ago ✅".
  • Result: you know your site's status every morning without opening the dashboard, and you don't discover missing backups on the day you need them.

This automation alerts rather than acts — and that is intentional. Blind automatic plugin updates on a live site are a gamble; the right approach is to test updates on a staging environment first. The backup strategy itself is a separate topic covered in the WordPress backup guide, and no alerting automation can replace it.

5. Site downtime monitoring

The simplest scenario on the list, and perhaps the most valuable for anyone who sells or gathers customers through their site.

  • Trigger: Schedule Trigger every 5 minutes.
  • Node 1: HTTP Request > GET https://example.com/ with the "Never Error" or "Continue On Fail" option enabled, so the error reaches the next node instead of killing the execution.
  • Node 2: IF > is the response code not 200, did the response time exceed 5 seconds, or is a word that always appears in the footer missing from the page?
  • Node 3: Telegram or a call/text message > an instant alert with the status code and response time.
  • Node 4: a node that suppresses repeat alerts — record a "down" state and don't send a new alert every five minutes throughout the outage; instead, send one alert when it goes down and another when it comes back.

Checking the page content in addition to the status code is not an unnecessary detail: many real failures return 200 while the page is blank or shows a database error. Look for a string that appears on every page and not on error pages. And if your alerts start repeating in fixed patterns, the problem is in the site, not the automation — see the guide to fixing common WordPress errors.

6. Collecting form data and syncing content

These two scenarios are close because they share the same logic: moving data from WordPress somewhere else without intervention.

For forms: most serious forms plugins support sending a webhook on every submission — you put the n8n URL in the form settings and you're done. Trigger: Webhook. Nodes: Set to normalize the field names (don't rely on the plugin's raw names, since they change with any edit to the form), then Google Sheets > add a row, then Slack > a notification to the team, then a CRM node if you have one. Result: every quote request reaches three places at the same moment, and none gets lost in a neglected inbox.

For content sync: the trigger is a Schedule every hour. The first node, HTTP Request > GET /wp-json/wp/v2/posts?modified_after=<last-sync>&per_page=100, fetches only what changed. Then a transform node reduces each post to the fields that matter to the destination, followed by a write to your database, your analytics tool or an external search index. The whole key is the modified_after parameter: without it you pull the entire site every hour; with it you pull only the changes. With a WooCommerce store, the same logic applies to the product and order endpoints.

ScenarioTriggerReal valueEffort
Scheduled publishing from a queueScheduleConsistent publishing without daily presenceMedium
Social media repostingWebhookInstant distribution, nothing forgottenMedium
Comment and spam monitoringSchedule (Polling)A clean queue and faster repliesHigh
Backup and update alertsScheduleCatching vulnerabilities before they are exploitedLow
Site downtime monitoringScheduleMinutes of downtime instead of hoursVery low
Collecting form dataWebhookNo lead gets lostLow
Syncing external contentScheduleA single source of truthHigh

What isn't worth automating at all?

Enthusiasm for automation leads to a recurring mistake: automating a task that runs once every two months and takes two minutes, with a workflow that took three hours to build and will need maintenance after every update. The criterion is simple and you shouldn't stray from it: the time saved per year must exceed the build and maintenance time combined, multiplied by a safety margin.

Which tasks are worth automating?Recurring tasksRare tasksRule-basedCreativeAutomate firstBackups · reportsAlerts · syncAutomate if neededOne-off migrationInitial setupSimplify / semi-autoCustomer repliesContent reviewKeep it manualDesignStrategic decisionsStart with the top-right quadrant: recurring tasks with clear rules = the highest return on automation
Choosing what to automate: recurring tasks with fixed rules (backups · reports · alerts) come first; rare, creative tasks stay manual.
TaskAutomate it?Reason
Publishing a finished post at a set timeYesRecurring, with clear rules, needs no human judgment
Distributing the post link to channelsYesPure copy and paste, and often forgotten
Site outage alertAbsolutelyHumans don't monitor around the clock
Classifying a suspicious commentPartlyAutomate the classification, but keep the deletion decision human at first
Writing the content itselfNoEditorial quality and brand voice can't be reduced to a template
Replying to a customer complaintNoNeeds context, empathy and judgment
Updating plugins automatically on the live siteNoThe risk of breaking the site outweighs the time saved — automate the alert, not the action
A task that comes up twice a yearNoThe cost of building and maintenance far exceeds the return

The broader rule is explained in the guide to automating repetitive tasks, and for more ready-made examples beyond WordPress, see practical automation examples with n8n.

How do you secure the connection?

Connecting n8n to WordPress opens a programmatic door into your site, and an open door needs a lock. Five practices cover 95% of the risks:

First, a dedicated user with the lowest role. This has come up three times in the article because it matters most: don't connect n8n to your personal administrator account, and don't give the Administrator role to a publishing task.

Second, a webhook path that can't be guessed. n8n generates a random ID by default — don't replace it with a "pretty" path such as /webhook/new-post. A long random path is half of the protection.

Third, a secret in the header. The other half: send a header such as X-Wp-Secret from WordPress, check it with an IF node at the very start in n8n, and stop anything that doesn't match. Without this check, anyone who knows the webhook URL can trigger your workflow with a forged payload whenever they like.

Fourth, HTTPS in both directions. The application password is sent in the Authorization header encoded in Base64 — and Base64 is not encryption. Without HTTPS, you are sending your site's key in near plain text. Make sure both sides have valid certificates, and add HTTP security headers to the n8n interface itself — and if you haven't set up a certificate yet, see the guide to installing SSL and enabling HTTPS.

Fifth, rotate keys and delete unused ones. Every application password you no longer use should be revoked from the user's profile immediately; the application passwords list shows when each one was last used, so review it every few months. The rest of the site's security fundamentals are in the guide to securing a WordPress site.

Troubleshooting: why isn't the connection working?

This section is built on the errors you will actually run into, ordered by how common they are.

SymptomMost likely causeFix
401 Unauthorized with a message about an incorrect passwordAn application password copied incompletely or with a trailing newline, or the wrong username (the email instead of the login name)Regenerate it and copy carefully; use the login name, not the email; test with the curl command above
401 even though the credentials are one hundred percent correctThe server doesn't pass the Authorization header to PHP (common with some FastCGI setups)Add a header pass-through rule in .htaccess or the Nginx config, or ask support
403 Forbidden with rest_forbiddenThe role lacks the permission the operation requiresRaise the role only to the minimum sufficient level — not to Administrator
404 on all of /wp-json/A security plugin blocking the REST API or hiding the path, or permalinks set to "Plain"Exempt the automation user in the plugin's settings; switch permalinks to "Post name"
403 from a firewall before the request reaches WordPressThe hosting firewall or CDN blocks POST requests from the n8n addressAdd the n8n server's IP address to the allowlist
The webhook never reaches n8nn8n is not reachable from the internet, or the workflow is in Test mode, not ProductionActivate the workflow (Active) and use the production URL; check the certificate and port
The workflow runs twice or more per eventThe WordPress hook fires more than once, or the sender retriesAdd a meta flag that prevents duplicate sends, and an IF condition at the start of the workflow
429 or severe slowness after a whileExceeding the request limits on the server or the CDNStretch the intervals, use per_page and modified_after, and add a Wait node

The subtle distinctions that save the most time:

The difference between 401 and 403 is decisive. The first says "I don't know who you are" — an authentication problem, meaning an application password, a username or a missing header. The second says "I know you, and you're not allowed" — a permissions problem, meaning the user's role. Don't fiddle with the password when the problem is the role, and vice versa.

Always test the two sides separately. If curl succeeds from the command line and n8n fails, the problem is in the credential or the node configuration inside n8n. If curl fails too, the problem is in WordPress or the server, and there is no point fiddling with n8n. This separation alone cuts diagnosis from hours to minutes.

The test URL is not the production URL. The most common frustration for beginners: they try the webhook and it works, then they close the screen and everything stops. The test URL in n8n only works while you are clicking the "Listen" button, and the production URL only works when the workflow is activated (Active). Make sure what you put in WordPress is the production URL and that the switch is on.

REST API limits are not unlimited. The per_page parameter is capped at 100 items per request; to pull more, paginate with page and read the X-WP-TotalPages header to know when to stop. And never fetch what you don't need: modified_after and _fields shrink both the payload and the time enormously. Pulling a hundred full posts every hour can genuinely slow the site down, which directly undermines all the effort you put into speeding it up.

Where do you actually start?

Don't build all seven scenarios in a day. The order that produces results fastest:

Week one: downtime monitoring. A three-node workflow, done in half an hour, and its value shows from the first outage. It is also the best exercise for understanding Schedule and IF with no risk to the site, because it only reads and writes nothing.

Week two: update and backup alerts. Still read-only, but it teaches you authentication and credentials in practice.

Week three: the first automation that writes to your site — scheduled publishing or reposting to your channels. Try it on a staging environment before the live site, because a faulty write through the API creates twenty duplicate drafts in seconds.

Only after that, move on to what needs judgment: comments and syncing. At every step, stick to the same principle — build one workflow that runs reliably for two weeks before you build the second. Ten half-built workflows are worse than one that works.

Frequently asked questions

Do I need a separate server to run n8n, or is my site enough?

You need a separate place to run it. n8n is a Node.js application and does not run inside shared WordPress hosting that only supports PHP. The two realistic options are the managed n8n cloud version or installing it on a VPS you own. Keeping it separate from the site is a benefit, not a nuisance — if your site goes down, n8n stays alive to tell you so, which is what makes the downtime monitoring scenario possible in the first place. The full installation steps are in the guide to installing n8n on a VPS.

Does the WordPress node in n8n support everything on the site?

No. The node covers only three resources: posts, pages and users, with create, get and update operations. It does not cover comments, categories and tags, the media library, plugins, or endpoints added by third-party plugins. For everything else, use the HTTP Request node on the right path under /wp-json/ with the same site credential — there is no security difference between the two approaches, since both use the same API and the same authentication.

What is the difference between an application password and an API key?

In WordPress they are effectively the same thing. An application password is the core mechanism built in since version 5.6; it is sent via HTTP Basic authentication and fully inherits the permissions of the user it was generated for. It needs no plugin and no extra configuration. Two things make it better than the account password: it only works for the REST API and doesn't open the dashboard, and it can be revoked on its own without changing your password and without breaking your other integrations.

Does automation slow down my site?

It depends on the trigger. A webhook costs next to nothing: one outgoing request when the event happens, and with blocking => false it doesn't delay the visitor or the writer at all. Polling is what can hurt: a request every minute to a heavy endpoint means 1,440 queries a day. Reduce the impact in three ways: stretch the interval as far as is acceptable, use modified_after to fetch only what changed, and set _fields to shrink the response size. With these three, the cost becomes negligible.

My security plugin blocks /wp-json — what should I do?

This is by far the most common reason the connection fails. Don't disable the plugin entirely; most security plugins let you exempt a specific user or a specific IP address from REST API blocking. Add the automation user or the n8n server's address to the exceptions and keep the block on everyone else — this is actually a more secure setup than the default: the API is closed to the world and open to a single known party. Also check your hosting firewall, since it may block the requests before they even reach WordPress.

How do I stop an automation from entering an infinite loop?

With three layers, not one. First: a meta flag on everything the automation creates (such as _created_by_n8n), and an IF condition at the start of the webhook workflow that ignores anything carrying this flag. Second: make the auto-publishing user different from the user who triggers the webhook, and check the author. Third: set a maximum number of executions in the workflow settings, and watch the execution log during the first two weeks. The first two layers prevent the loop; the third limits the damage if the first two fail.

Can I connect them without writing any code in functions.php?

Yes, absolutely. From n8n to WordPress there is no code at all — the WordPress or HTTP Request node with a credential. From WordPress to n8n you have two no-code options: a webhooks plugin that fires an event when a post is published, a new comment arrives or a user registers and sends it to your URL, or the built-in webhook settings in the forms plugin you use. Code directly in functions.php gives finer control and a lighter payload and doesn't add a new plugin, but it is not required to get started. For those who want the theoretical basis for this whole integration, the n8n entry in the wiki is a good starting point, and the plugins entry explains how to choose a reliable webhooks plugin.

Sources

Frequently asked questions

Do I need a separate server to run n8n, or is my site enough?

You need a separate place to run it. n8n is a Node.js application and does not run inside shared WordPress hosting that only supports PHP. The two realistic options are the managed n8n cloud version or installing it on a VPS you own. Keeping it separate from the site is a benefit, not a nuisance — if your site goes down, n8n stays alive to tell you so, which is what makes the downtime monitoring scenario possible in the first place. The full installation steps are in the guide to installing n8n on a VPS.

Does the WordPress node in n8n support everything on the site?

No. The node covers only three resources: posts, pages and users, with create, get and update operations. It does not cover comments, categories and tags, the media library, plugins, or endpoints added by third-party plugins. For everything else, use the HTTP Request node on the right path under /wp-json/ with the same site credential — there is no security difference between the two approaches, since both use the same API and the same authentication.

What is the difference between an application password and an API key?

In WordPress they are effectively the same thing. An application password is the core mechanism built in since version 5.6; it is sent via HTTP Basic authentication and fully inherits the permissions of the user it was generated for. It needs no plugin and no extra configuration. Two things make it better than the account password: it only works for the REST API and doesn't open the dashboard, and it can be revoked on its own without changing your password and without breaking your other integrations.

Does automation slow down my site?

It depends on the trigger. A webhook costs next to nothing: one outgoing request when the event happens, and with blocking => false it doesn't delay the visitor or the writer at all. Polling is what can hurt: a request every minute to a heavy endpoint means 1,440 queries a day. Reduce the impact in three ways: stretch the interval as far as is acceptable, use modified_after to fetch only what changed, and set _fields to shrink the response size. With these three, the cost becomes negligible.

My security plugin blocks /wp-json — what should I do?

This is by far the most common reason the connection fails. Don't disable the plugin entirely; most security plugins let you exempt a specific user or a specific IP address from REST API blocking. Add the automation user or the n8n server's address to the exceptions and keep the block on everyone else — this is actually a more secure setup than the default: the API is closed to the world and open to a single known party. Also check your hosting firewall, since it may block the requests before they even reach WordPress.

How do I stop an automation from entering an infinite loop?

With three layers, not one. First: a meta flag on everything the automation creates (such as _created_by_n8n), and an IF condition at the start of the webhook workflow that ignores anything carrying this flag. Second: make the auto-publishing user different from the user who triggers the webhook, and check the author. Third: set a maximum number of executions in the workflow settings, and watch the execution log during the first two weeks. The first two layers prevent the loop; the third limits the damage if the first two fail.

Can I connect them without writing any code in functions.php?

Yes, absolutely. From n8n to WordPress there is no code at all — the WordPress or HTTP Request node with a credential. From WordPress to n8n you have two no-code options: a webhooks plugin that fires an event when a post is published, a new comment arrives or a user registers and sends it to your URL, or the built-in webhook settings in the forms plugin you use. Code directly in functions.php gives finer control and a lighter payload and doesn't add a new plugin, but it is not required to get started. For those who want the theoretical basis for this whole integration, the n8n entry in the wiki is a good starting point, and the plugins entry explains how to choose a reliable webhooks plugin.