Support

Account

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 get_field_object('field_0123456789abc');