Roots Discourse

ACF 5.11 - Problem with get_field() from options

Hi!
I am using Sage 10 with acf composer.
After the last update of ACF PRO to version 5.11, there was a problem with reading the fields.
I cannot read the values ​​of some fields. The return is NULL.

example in functions.php

$account_page = (is_array($account_page)) ? $account_page['url'] : $home_url;
define('ACCOUNT_PAGE', $account_page);

The same is the case with the php script that handles the form

session_start();

include 'vendor/autoload.php';
use Hybridauth\Hybridauth;

$google_login = (get_field('google-login-api', 'option')) ?? null;

How to fix this in acf-composer?

Issue in ACF GH - get_field returns null after upgrading to v5.11 · Issue #570 · AdvancedCustomFields/acf · GitHub

The issue you linked indicates you’re trying to get the values of those fields before ACF knows they exist. You could adjust load order, or just get the field data with WordPress functions instead of ACF’s.

I tried to change the priority in the register() function on acf composer, but unfortunately to no avail.

Can you use get_option('google-login-api')?

Yes, now its works. Thanks you!