Greetings. I’m attempting to write a function that removes all data from a flex component on a given post and I am struggling. I think part of it may be due to me not completely understanding what a row, sub row, layout, or field is in context to flex content. So lets say that on post #999, we have a flex field called community_flex_components and it has this acf data (json representation for brevity):
So for brevity sake, I didn’t want to post every permutation of code that I tried. But taking a second look through them I realized I had some arguments out of order on one and it now seems to work. This will essentially “shift” the first layout (row?) off of the flex component:
delete_row('community_flex_components', 1, 999)
So given the warning about running delete_row() inside of have_rows loop, is the following an effective way to properly empty a flex component?