ACF fields work using standard WP functions for get_post_meta() and get_option(). The functions in ACF are only wrappers for these functions.
The problem is that if you use them on a field and you don’t use the ACF functions that the values will not be formatted for you.
For example, when you create an image field and set it to return a URL. ACF does not (and never has) stored the URL of the image in the field. ACF stores the attachment ID of the image. get_post_meta() is not a theme specific function, it is a WP core function and is always available.
In order to get the URL when using get_post_meta() you need to do the work of getting the URL field yourself.
The same is true of any field that stores anything that is not a simple text value, like multi-select, page link, repeaters, relationship, post object, checkbox, taxonomy, flexible content, file, gallery, true/false, user, google map, date picker, time picker, and date/time picker fields.
Viewing 4 posts - 1 through 4 (of 4 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