Home › Forums › Front-end Issues › Error after updating › Reply To: Error after updating
Hi there,
I’m having the same issue but struggling to implement the fix as it seems either to be ineffective or site-breaking. Hopefully you can show me what I’m missing!
Query Monitor is telling me the function that’s falling over – the ‘tmea_get_country()’ function:
get_field()
wp-content/plugins/advanced-custom-fields-pro/includes/api/api-template.php:23
tmea_get_country()
wp-content/themes/tmea_theme/functions.php:24
The function is very simple – it just works out which country that site is set up for:
function tmea_get_country()
{
//default to UK if no country found
if (!function_exists('get_field')) {
$tmea_country = 'UK';
} else {
$tmea_country = get_field('tmea_country', 'option');
}
return $tmea_country;
}
I tried putting that function in the add_action() as recommended above, but it didn’t work.
add_action('acf/init', 'tmea_get_country', 10)
The first call for that function is a couple of lines later:
require_once(__DIR__ . '/functions_' . strtolower(tmea_get_country()) . '.php');
Putting that in the add_action broke the site because various functions weren’t available.
How can I resolve this, please?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.