Custom function making troubles in get_permalink for ACF relationship fields
You shouldn’t rely on the global $post variable for filters like this. In your example you’re passing $event_city->ID to get_the_permalink(). This implies that the $event_city post is not for the same post as the current $post object. This is normal. Sometimes you want to use a function like get_the_title() or get_the_permalink() without changing the global … Read more