How can I add multiple categories on Wordpress module?

Hey,

I’m new to make.com and I couldn’t find any guide on how to get Wordpress category name from different cell values so it chooses the correct one when posting the articles.

I have a scenario where “Sheets” is connect to “Wordpress” and for each article, there is a different category.

It should look like this: website.com/how-to-buy/category1/category2

The parent category is “how-to-buy”, category 1 and 2 are the ones I want to add to the wordpress category module (those values will come from the sheet).

How can I do that?

P.S. Sorry for my bad English.

image

Welcome to the Make community!

The Categories field accepts an array of category IDs.

You will need to use the Wordpress “Search Categories” module for each category, then array aggregate the results.

Screenshot_2024-02-07_200213

Every result (item/record) from a search/match module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and has applies to many use-cases.

READ THIS

The Array Aggregator module allows you to build an array for a later module’s field to map multiple items to it.

Here is an example of using the “Target structure type” of an Array Aggregator module:

As you can see, the “Map” toggle on fields are used when you have an array. You can easily build an array variable to map to a field, by using an Array Aggregator module and select the “Target Structure Type” as the future field you want to map the array into.

For more information, see Aggregate an array for mapping complex fields

2 Likes

Wow, that’s quite hard haha

I’m really new to this… there is not easier ways?

To make myself clear, this is what I want to do:

eg. Category1 = Food
Category2 = Meat
The values from those categories will come from the google sheets.
So the “categories” in the Wordpress modules will be “Category1”+“Category2”

If you already know the two category IDs, you can use the add() built-in function with the first item as emptyarray:

Screenshot_2023-10-12_211010

But you have the category names, so you have to get their IDs first using the method I mentioned above.

3 Likes

The flow looks like this now:

I added the “Search categories” module that should search for the rows value “Currency (A)” that is also a category name in Wordpress (for example the cell value is “USD”, the category is the same name on Wordpress)

Then I added the Array aggregator like this:

And in the final module, I added what you said:

image

But when I run it I get this:

Every result (item/record) from a search/match module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module.

IMPORTANT INFO

The Array Aggregator module also allows you to build a complex array of collections for a later module’s field to map multiple items (collections) to it.

Here is an example of using the “Target structure type” of an Array Aggregator module:

As you can see, the “Map” toggle on fields are used when you have an array. You can easily build an array variable to map to a field, by using an Array Aggregator module and select the “Target Structure Type” as the future field you want to map the array into.

2 Likes

I still don’t understand… Can you please send some screenshots with how to do it using the modules that I have?

Hmm, looks like Target Structure Type doesn’t work for the Categories field (might be a bug)

So just use the built-in function map to get just the category IDs:

4 Likes

It worked now. Thank you so much for everything, you’re the best!

3 Likes

No problem, glad I could help!

By the way, it’s the same method for the Tags field - I just gave it a try.

3 Likes