Are you sure this function is casing the problem? Does the problem go away if you comment out the add_action line?
If this function is causing the problem the only thing I can think of by looking at this function is that in may have to do with the ‘post_name’ value. Try commenting out those lines and see what happens.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users