Home › Forums › General Issues › WP archive with custom field filter › Reply To: WP archive with custom field filter
Use the field key here instead of the field name
$field = get_field_object('city');
The reason why is because of the current post does not have any values then ACF does not know how to get the field object. ACF uses a combination of the field name and the post ID to look up the field key, when there is not value ACF cannot find the field key and cannot get the field object.
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.