Wordpress - Add more than one category

Hello team and community.

I have a little problem with my wordpress automation.

As soon as I want to create an article automatically on wordpress. I want to add 2 categories. A parent category and a child category.

However, when publishing, only the child category is linked to the article.

I’ve tried adding the 2 categories directly to the input, but it doesn’t work.

Par ailleurs lors de la création de la catégorie “enfant”, je précise la catégorie parente :

Thx for you help if you already have this problem.

regards

According to the Wordpress API for Create a Post, it needs to be an array.

Screenshot_2023-10-12_201034

When you are using “Map” for a field, you are responsible for ensuring the value is exactly as required. However, the Wordpress API documentation doesn’t tell you that you can also pass a comma-separated text string of category IDs:

Screenshot_2023-10-12_201024

So all you need to do is put a comma in-between them

Screenshot_2023-10-12_201005

2 Likes

Hello Samliew,

I do this too but not working and “;” also :frowning: Sorry i miss communication.

Hmm. Weird, try sending an actual array then. You’ll need to use the add() built-in function with the first item as emptyarray:

Screenshot_2023-10-12_211010

3 Likes

Works very well :smiley: really thanks buddy !

No problem, glad I could help!

In future, please create a new thread for each question. This makes it easier for others with the same problem to search for the answer. Thank you for your cooperation!

The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

  • others can save time when catching up with the latest activity here, and
  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3 Likes