PHP Fatal error: Uncaught Error: Call to undefined function get_field() in header.php

Keywords: WordPress - AWS - Technical issue - Services (Apache, MariaDB, MySQL…)

bnsupport ID: 33d71dbb-ad35-1d50-fef8-f8501c297088

bndiagnostic output:

? Apache: Found possible issues
? Php: Found possible issues

bndiagnostic failure reason: The suggested guides are not related with my issue

Getting the following error in my Apache error log (theme name redacted and replaced with [theme]):

AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function get_field() in /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/[theme]/header.php:52
Stack trace:
#0 /opt/bitnami/apps/wordpress/htdocs/wp-includes/template.php(730): require_once()
#1 /opt/bitnami/apps/wordpress/htdocs/wp-includes/template.php(676): load_template('/opt/bitnami/ap...', true, Array)
#2 /opt/bitnami/apps/wordpress/htdocs/wp-includes/general-template.php(48): locate_template(Array, true, true, Array)
#3 /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/[theme]/front-page.php(1): get_header()
#4 /opt/bitnami/apps/wordpress/htdocs/wp-includes/template-loader.php(106): include('/opt/bitnami/ap...')Press [Enter] to continue:
#5 /opt/bitnami/apps/wordpress/htdocs/wp-blog-header.php(19): require_once('/opt/bitnami/ap...')
#6 /opt/bitnami/apps/wordpress/htdocs/index.php(17): require('/opt/bitnami/ap...')
#7 {main} thrown in /opt/bitnami/apps/wordpress/htdocs/wp-content/themes/[theme]/header.php on line 52'

It looks like it’s a function in the ACF Pro plugin, but I haven’t made any changes to my configuration. A pentest was run earlier which resulted in PageSpeed Serf fetches all failing and the server reaching the max_children setting, but I’ve restarted the server and continue to see the PHP issue above

Hello @aamir_astarte,

It seems this error may be coming from the theme itself, but you can try disabling the ACF Pro plugin or checking with the developers how it can be affecting your theme. Apart from that, please try disabling PageSpeed, at is known to be problematic in selected cases:

Francisco de Paz

Thanks @fdepaz. I’ve restored an instance from a backup snapshot to resolve the downtime for now, but will try your solutions if the issue happens again or if there’s a situation where I can plan to test these changes, and I’ll update this post with my findings if it’s still open.