I meant I’m not familiar with the template system you’re using. My only guess is that it has something to do with it.
So, you car calling it here…
{% if post.post_title == 'Submit' %}
{{ function('acf_form_head') }}
{% endif %}
{{ wp_head }}
</head>
and acf_form_head() needs to be called before any HTML is output. This is not the case since the opening <html>
tag and open <head>
tag must be before this point. You are calling the function on the wp_head action, which happens after the get_header() function is called.