Problem creating WordPress post

When trying to make a post in WordPress and I came across the following problem: it returns the existing posts as if it were doing a get all and does not post

The same behavior happens with update

Tested with 0.236.3 and 1.4.1

Hi @Claudio_Balbino, I am very sorry you’re having trouble. I recently tested posting on WordPress through n8n and this worked fine:

Following your message I have re-tried running this very workflow using [email protected], but am only seeing data from the new post as expected:

Is there a chance you are using some plugin (or perhaps a caching layer) that would cause your response to look any different? Perhaps you can share enough additional information on your setup for me to reproduce the problem?

Hi @MutedJam

It had no plugin, this wordpress was installed just to do tests with n8n.

I installed a new wordpress and the behavior is the same. When I try to create a post it returns the existing ones and does not create a new post

Follow print when an instance with version 0.236.2

Follows print when an instance with version 1.4.1… same behavior, returns existing post data

Can you confirm how exactly you have set up your Wordpress instance please? For reference, I was testing the below docker compose setup:

services:
  
  n8n:
    image: n8nio/n8n:1.4.1
    restart: unless-stopped
    ports:
      - 5678:5678
    volumes:
      - ./n8n_data:/home/node/.n8n

  mysql:
    image: mysql:latest
    restart: unless-stopped
    ports:
      - 3306:3306
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=1
      - MYSQL_DATABASE=wordpress
      - MYSQL_USER=wordpress
      - MYSQL_PASSWORD=wordpress
    volumes:
      - ./mysql_data:/var/lib/mysql

  wordpress:
    image: wordpress:latest
    restart: unless-stopped
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: mysql
      WORDPRESS_DB_USER: wordpress
      WORDPRESS_DB_PASSWORD: wordpress
      WORDPRESS_DB_NAME: wordpress
      WP_ENVIRONMENT_TYPE: development
    volumes:
      - ./wordpress_data:/var/www/html

I’m using Railway, follow the dockerfile configuration

Hi @Claudio_Balbino, apologies for the late reply, this has gotten lost among the many forum threads :frowning:

Are you still seeing this problem? My WP setup looks very similar to yours, so I don’t see anything obvious. Seeing you are getting a response containing another post it almost seems like the POST request made by the n8n node is transformed into a GET request (fetching posts) along the way.

Are you also seeing this problem when creating a new post through the HTTP Request node instead?

I just installed n8n and I’m experiencing the same behavior. Are there any updates to this?

edit: nevermind. I had to change my credentials url to https.

1 Like

I had also also issues with the standard wordpress node not only for reliability, but also for performance, as the output always contains the complete post and on many posts/products etc. a workflow could come to a stalled error. In first place I would recommend to check if your authentification is correct and your Wordpress settings even allow you to post which has to be activated, because on default the Wordpress API only allows you to GET posts.

Now I am using HTTP Request Node following: Reference | REST API Handbook | WordPress Developer Resources

https ://yourwpurl.com/wp-json/wp/v2/post/postid?_fields=id,permalink

(giving only id + permalink as output to save ressources)

Use POST with query parameters in JSON or fields like you wish

{
  "title": "Your Post Title",
  "status": "publish"
}

Using the HTTP Request node also allows you to manage ACF fields and other stuff which is not possible in the default wordpress node.

1 Like

Hello,
I am encountering a similar problem where using POST in WordPress is transforming into a GET request, displaying all existing posts.
n8n version: 1.20.0.
Could you please share more details about your workaround using an HTTP request for the same purpose?
–Thanks in advance

Hi @akshansh_saini, I am sorry you’re having trouble.

As mentioned further up, I was unable to reproduce this and suspect it might be related to your exact WordPress setup. Can you please describe exactly how one can re-create this problem from scratch?

As suggested by @prononext, it might be worth using the HTTP Request node here instead of the Wordpress node to make sure you send the exact API request required by your WordPress instance.

@MutedJam facing the same problem too. Sending a post request results in only a GET. And using HTTPs node

having the same iexact issue. Has anyone managed a solution?

Solved by disabling W3 cache plugin

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.