add_filter('acf/save_post', 'possibly_delete_post');
function possibly_delete_post($post_id) {
$post_type = get_post_type($post_id);
// change to post type you want them to be able to delete
if ($post_type != 'post-type') {
return;
}
if (get_field('delete_this_post', $post_id)) {
$force_delete = false; // move to trash
// change above to true to permanently delete
wp_delete_post($post_id, $force_delete);
// redirect them somewhere since the post will no longer exist
// see https://developer.wordpress.org/reference/functions/wp_redirect/
wp_redirect('/some_page/');
exit;
}
}