Support

Account

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?