# Wordpress custom post types

**URL:** <https://community.n8n.io/t/wordpress-custom-post-types/3368>\
**Category:** Nodes\
**Created:** [December 12, 2020, 5:01pm UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368 "2020-12-12T17:01:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ljcn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ljcn/32/2726_2.png) [@ljcn](https://community.n8n.io/u/ljcn)\
**Post date:** [December 12, 2020, 5:01pm UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/1 "2020-12-12T17:01:34Z")

</div>

Hi all, I’ve got N8N up and running!  
I’m hoping to use it to do the following:  
Each time a post is added, an object is created in HubSpot. I’ve got this working for traditional post, but my Wordpress uses custom post types. All of the json info is public at [Best Website Builder | Create Websites Easy – Yoursite.com](https://www.yoursite.com/wp-json/geodir/v2/CPT)  
Is it possible to get N8N to pull posts from this endpoint?

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [December 13, 2020, 12:30am UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/3 "2020-12-13T00:30:55Z")

</div>

Welcome to the community.

Not sure if I understood well, but if you want to get that JSON into n8n, you can use the HTTP node.

```
{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://carenav.co.uk/wp-json/geodir/v2/norfolkandwaveney",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        550,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const data = items[0].json\n\nconst results = [];\n\nfor (const item of data) {\n results.push({\n json: item\n })\n}\n\nreturn results;"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        790,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![ljcn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ljcn/32/2726_2.png) [@ljcn](https://community.n8n.io/u/ljcn)\
**Post date:** [December 13, 2020, 12:54am UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/4 "2020-12-13T00:54:06Z")

</div>

Thanks @RicardoE105, really appreciate it!  
Forgive my ignorance, I’m very new to api, and I’ve tried reading the n8n docs but I’m not sure where to use that code you’ve provided. I’ve used the http request node which provides the following (image)

All I need from here is the ‘title’ and ‘link’ to create a new object in Hubspot. Thanks again for your help!

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [December 13, 2020, 1:00am UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/5 "2020-12-13T01:00:16Z")

</div>

No problem. Just copy the code I just provided and paste it in the workflow editor. Just add the hubspot node at the end and it should do it. Did not add it myself cuz I do not know how you wanted to save in hubspot.

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [December 13, 2020, 1:03am UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/6 "2020-12-13T01:03:57Z")

</div>

Also so that you know, if you want to react every-time a post is added, you are gonna need a bit more work. If I were you I would add a plugin for webhooks in your wordpress instance, catch the event with a webhook node and then get that data into hubspot.

---

<div class="post-metadata">

**Author:** ![ljcn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ljcn/32/2726_2.png) [@ljcn](https://community.n8n.io/u/ljcn)\
**Post date:** [December 13, 2020, 1:08am UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/7 "2020-12-13T01:08:23Z")

</div>

Thank you, it seems I’ve still got a lot to learn!

---

<div class="post-metadata">

**Author:** ![ljcn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ljcn/32/2726_2.png) [@ljcn](https://community.n8n.io/u/ljcn)\
**Post date:** [December 13, 2020, 1:17am UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/8 "2020-12-13T01:17:50Z")

</div>

@RicardoE105 - please forgive me! I’m still unsure where to insert the code you’ve provided.  
Also, the update doesn’t necessarily need to be instant. Would it be easier to run via cron or instantly via a webhook (using a wordpress plugin)?

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [December 13, 2020, 1:26am UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/9 "2020-12-13T01:26:36Z")

</div>

> please forgive me! I’m still unsure where to insert the code you’ve provided.

[https://www.loom.com/share/5b92d213cecb4213a0d0069c5f6d60c9](https://www.loom.com/share/5b92d213cecb4213a0d0069c5f6d60c9)

> Also, the update doesn’t necessarily need to be instant. Would it be easier to run via cron or instantly via a webhook (using a wordpress plugin)?

you could use the cron node to check for updates every x time, but it will be more difficult as you have to always check if there is new data. Using the webhook this is handled for you. btw I have not ever used a webhook plugin for WordPress, I’m just guessing that one must exist.

[https://wordpress.org/plugins/search/webhooks/](https://wordpress.org/plugins/search/webhooks/)

---

<div class="post-metadata">

**Author:** ![ljcn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ljcn/32/2726_2.png) [@ljcn](https://community.n8n.io/u/ljcn)\
**Post date:** [December 13, 2020, 1:30am UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/10 "2020-12-13T01:30:13Z")

</div>

oh! As easy at that! Now I feel stupid!

> you could use the cron node to check for updates every x time, but it will be more difficult as you have to always check if there is new data. Using the webhook this is handled for you. btw I have not ever used a webhook plugin for WordPress, I’m just guessing that one must exist.

Makes sense! Hubspot’s API is capable of checking for new posts, but a webhook would make more sense. This is very helpful, thank you so much!

---

<div class="post-metadata">

**Author:** ![ljcn](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ljcn/32/2726_2.png) [@ljcn](https://community.n8n.io/u/ljcn)\
**Post date:** [December 13, 2020, 1:19pm UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/11 "2020-12-13T13:19:46Z")

</div>

Hi @RicardoE105,  
Just a note to say thank you again!  
It’s working perfectly! Each new post sends a webhook to n8n, which works its magic and adds to hubspot just as I needed.

I’m running n8n through PM2 to keep it active. However, doing it this way doesn’t load any configuration, specifically my authentication. If I run n8n the usual way, the configuration loads fine (I’m using a config file), but I need n8n to always be running. Any thoughts?

**EDIT for those experiencing similar:** I was using a custom configuration file rather than a .env file. Since using a .env file all is working perfectly. Thanks again for an incredible app and supportive forum!

---

<div class="post-metadata">

**Author:** ![Raja\_Dharma](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/raja_dharma/32/45403_2.png) [@Raja\_Dharma](https://community.n8n.io/u/Raja_Dharma)\
**Post date:** [December 28, 2024, 3:51am UTC](https://community.n8n.io/t/wordpress-custom-post-types/3368/12 "2024-12-28T03:51:04Z")

</div>

I am using JetEngine plugin in Wordpress, for creating Custom Post Type called “Article”.  
How to publish blog in CPT (Article). When i connect, i can only see default post type, not CPT
