How To Delete Row From Repeater ACF Using PHP

How To Delete Row From Repeater ACF Using PHP

In order to delete a row from repeater ACF using PHP, you have to open functions.php and use the following code.

In the below example $repeater_key is the key of the element that was clicked. You have to check if the keys start from 0, if they do, you will have to increment it by 1.

$repeater_key = (int)$_POST['key'];
delete_row('field_615c0bb5ceb1d', $repeater_key, $post_id);

If you want to delete a row from the user group, you will have to change the code like the following:

delete_row('field_615c0bb5ceb1d', $repeater_key, 'user_'.$post_id);

Also if you want to delete a row from the taxonomy group, your code should look like something like that:

delete_row('field_615c0bb5ceb1d', $repeater_key, 'term_'.$post_id);

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x