Best answer

Update Wordpress Post with Tags, with looping seems only keeping one tag

  • 18 August 2023
  • 2 replies
  • 62 views

Userlevel 1
  • I am looping through a set of Tags in my zap.
  • I’m using loop bc I need to search if the Tag is in my Google Sheet.
  • If it is Found, I just grab the ID update the Post.
  • If it Not Found, I create one using WP API, then Update Post.

This is the beginning of Zap (I had a problem with the Line-Item search and discovered Looping)

 

It seems while Looping through the Tags and Updating the Tag, it removes the previous Tag that was added and insert the most current Looped one.

 

Inserting latest Tag that was created by API call

Is there a way to save all that were looped and add them at once; it would need to include the Tags Found and the Tags just Created.

 

THanks!

icon

Best answer by jayeshkumarbhatia 18 August 2023, 13:29

View original

2 replies

Userlevel 6
Badge +6

Hi @gravitygone ,

 

Yes, it is possible to do this. The reason of failure is that the input has to be an array of all tag ids. You can add below actions between If Tag found filter action

 

If tag found in Google Sheet (This action already exists in your Zap)

Action A - Use Storage by Zapier - Action Push value into list (The key that you can use is Wordpress Post Id)

Action B - Filter - If looping execution is last equals True

Action C - User Storage by Zapier - Get Values (The key that you can use is Wordpress Post Id)

Action D - Update Wordpress Post with Tags from Action C (This action already exists in your Zap)

Action E - Storage by Zapier - Remove value of predefined key (The key that you can use is Wordpress Post Id)

Userlevel 7
Badge +14

Hi @gravitygone 

Good question.

Looping iterations run in parallel, so you may want to consider adding a Delay step as part of your approach to avoid race conditions.

Reply