Home › Forums › Feedback › get_field_ID() › Reply To: get_field_ID()
When displaying a post editor, or taxonomy editor or any form that ACF let’s you add a field group to ACF determines this by looking at the location rules for that field group and comparing them to the current “location”. When the post is saved in the admin the fields are saved to the object being saved, there isn’t any reason to check the location, acf just saves any ACF fields that are submitted using the current WP object ID.
When getting values ACF uses the global “$post->ID” to get values and this is why you must supply a post ID for anything other than the post in “The Loop”
In order to do what you want you would need to do a WP query for a post in that post type where the field “Exists” and then use the post ID returned from this in combination with the field name to get the field object.
Alternately, this can be done more easily by using the field key
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!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.