Hey folks looking for some help with wordpress tags ids. I am getting new Tag Names from Airtable> and creating the WP IDs for these if they dont exist. Now for the life of me I can not get the create WP Post to ADD all the new tag IDs to a single post. the Wordpress create post is creating multiple posts each with 1 of the tag ids! Ive spent a very long time and tried everything I can think of - can anyone help thanks
What am i missing? AI overlords have not helped
What is the error message (if any)?
Wordpress is creating Multiple posts - 1 post for each TAG ID but i need 1 WP Post with aLL the tag ids added. Tried execute once but then i just get 1 tag created
Please share your workflow
]
]
},
"Create WP With All tags": {
"main": [
[]
]
}
I think what is happening is your workflow is passing multiple items down the workflow and therefore will create one post for each item in the workflow.
You could try and add a code node after your set items node to bring all of the tag ID’s together and then use that as an expression in the post to WP node.
Here’s an example of the function to use in the code node:
let tagIds = [];
items.forEach(item => {
if (item.json.body && item.json.body.length > 0 && item.json.body[0].id) {
// Push the ID to the array
tagIds.push(item.json.body[0].id);
}
});
const tagIdsString = tagIds.join(',');
return [{
json: {
tagIds: tagIdsString
}
}];
This should return:
[
{
"tagIds":
"19,20,21"
}
]
and use the expression in the post to WP node.
You might need to play around with that a little more - for example, I think another issue you will have is where you have the Set Node. As you have an IF node and you need the input from both branches, you probably will need a Set Node at the end of both branches that is set up the same on both branches to output the same thing, then a merge node to pull them both together
hey finally have it working after WAY too long - thanks for pointing me in the right direction. I actually got it working with an Aggregate array in the end woo hoo!
hey thanks - see my later post - ive got it working using the aggregate node - it seems i had not been setting this up to create an array correctly. Thanks for the input