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.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users