EUREKA! John, you are a genius. I think if I had just removed the global $post in the very beginning it would have worked fine – when I put the code back to the way it was before (and exactly as you suggested) and removed global $post, it is working perfectly.
Thank you a huge amount! If this forum had the emoji for a hug, I would include it here. 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users