Hi John, Thanks for your code.
I had trouble with this today, not all rows were being removed.
I needed to remove them in reverse order:
$existing_locations = get_field('rp_locations', $post_id);
if( !empty($existing_locations) )
{
for( $index = count($existing_locations); $index > 0; $index-- )
{
delete_row('rp_locations', $index, $post_id);
}
}
Ah thank you! Yes we are using The Events Calendar.
Cheers.
THANK YOU!
Exactly what I needed, fantastic!
Also, if you want to make that field be uneditable/disabled add this (before the return):
$field['disabled'] = 1;