As far as I know there isn’t a way to get a field object by the field name when there is nothing already in the database for that field.
Instead of using the field name in get_field_object, use the field key, or in this case, just hard code the field key for that field.
In ACF, multiple fields can have the same name. ACF does not know which field to get unless it can get the key form the database for whatever object the field is attached to, like a post or term or options.
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!
ACF PRO’s Flexible Content field allows you to create smaller pieces of UI and compose them into whole flexible patterns. In our latest article, we show how to use it to create swappable site sections and integrate it all in a theme.https://t.co/ZRocH8oJSp— Advanced Custom Fields (@wp_acf) January 24, 2023
© 2023 Advanced Custom Fields.