You can use a custom action hook like the following. This example is for a specific post type and field group, which helps to keep it performant. Obviously, you would need to adapt it to your use-case:
<?php
add_action('save_post', 'update_custom_dealers_table', 10, 3);
function update_custom_dealers_table($post_id, $post, $update)
{
// If this isn't a 'dealer' post, don't update it.
if ($post->post_type != 'dealers') {
return;
}
// update custom fields
$fields_to_update = [
'field_658f34acfa8b1' => 'dealer_type',
'field_63e2523c7b2a8' => 'netsuite_id',
'field_63bc663415a82' => 'phone',
'field_63e16cc724134' => 'fax',
'field_63bc664f15a83' => 'website',
'field_63e252187b2a7' => 'website_domain',
'field_63bc67275b5ea' => 'open_hours',
'field_63bc7f1f02a3b' => 'location',
];
$acf_cpt = new Acf_ct_register_hooks();
$_POST['_acf_changed'] = "1";
$_POST['acf'] = [];
foreach ($fields_to_update as $field_key => $field_name) {
$field_value = get_metadata_raw('post', $post_id, $field_name, true);
if ($field_value !== false) {
if (ctype_digit($field_value)) {
$field_value = (int) $field_value;
}
$_POST['acf'][$field_key] = $field_value;
}
}
// Call the function to handle saving the post
$acf_cpt->acf_ct_handle_save_post($post_id);
}
You can find the field keys for your scenario by enabling ‘key’ under ‘Screen elements’ in the field group edit screen.