How to update multiple categories to a wordpress post

I have wordpress post with post id : 2158
It already have a category id : 113
I wanted to add one more category id 959 to the post.
How I can achieve it via make.com
Input bundle
[
{
“id”: 2158,
“type”: “posts”,
“categories”: [
“[113, 959]”
]
}
]

Output bundle
[
null
]

Welcome to the Make community!

You’ll need to split the categories by comma-space so that it becomes an array.

Then, use an iterator on the array so that you can process each category at a time.

Create new category using the name.

Then, if category exists, there will be an error. Handle the error by searching for the category, and resuming with the existing category ID.

Then, aggregate the category IDs into an array using the Array Aggregator.

You can then insert the array of category IDs into the tag/category field.

Similarly, this works the same way for the Wordpress Tags field.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

1 Like

Can you check the value to be given in categories field
map(Array;id)
Resulting in to the following error
[400] Invalid parameter(s): categories (error code: rest_invalid_param)
categories: categories[0] is not of type integer.
blueprint(4).json (25.6 KB)

blue print of the scenario also attached for reference.

Adding one more blue print which also failed
blueprint(5).json (34.9 KB)

He Samilew, Can you share your blueprint connected to the above ?