When i use the function delete_row() en have a parameter selector it ignores it and always deletes the last row. I use repeater field btw.
My code looks like this.
delete_row(‘post_comments’, ‘1’, $post_id);
and it results in always deleting the last row and never the first or second when i change the number.
I honestly don’t know what delete_row actually does, I’ve never used it, haven’t had a reason to yet. According to the documentation it deletes the entire row and is not supposed to just clear the values from it. So if the repeater has 5 rows and you delete on of them then it should only have 4 rows, at least that’s what I get from reading this http://www.advancedcustomfields.com/resources/delete_row/
I made a workaround with an true or not true field so that it looks like the row is deleted.
From a developers perspective i can understand why the function doesn’t work so i don’t think it’s a bug or something. It’s just hard to change all the row fields by one function. When you use acf_form() it’s easy to delete because the other fields get saved to.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!