I’m trying to create a new custom post type in WordPress using an Airtable node as a trigger and a HTTP Request to create the custom post type based on the info from Airtable.
All is going well, no error, but some custom fields that are created in WordPress ACF are not populated with data.
All the rest: slug, title, link, status, type(post type) are working fine.
Hi @Darius_Dumitru ,
This is an issue of WordPress, not n8n, it happens with other CPT types.
First make a POST request with the WP native fields, “title”, “descriptions” to create the the post initially, then make another POST request this time with the POST ID given by the first request but to update the post, and you then need to add ACF fields this way as you need to pass the data as a JSON encoded acf object,:
{
"acf": {
"author": "Abraham (Abe) Simpson"
}
}
Note - Always worth to check also, if you exposed ACF fields in the REST API
The second field probably appeared when you made the first request, when you make POST requests in WordPress and field does not exist, WordPress creates that as metadata as custom field in the post meta:
Hi @Darius_Dumitru ,
You need to make a second call to update the ACF fields, After you 1st POST request you need to call another POST request, this time using ID to update, but try to use RAW instead of fields and build the JSON with example as I showed
Hi @Jorge_M. I would greatly appreciate if you can take a look as I think I’ve tried everything and it still doesn’t work. Can I send you a private message with the login details?
Hi @cesar_dev ,
“ACF” is the response of the JSON body, basically ACF builds the extra fields on top of the WordPress API native fields.
In order to POST, you need to change “ACF” to “fields”.