When you use get_field or the_field in the normal page template, they have access to the global $post object and can find the correct $post_id to load data from.
Within a widget, however, the functions may not be able to find this global $post object. Perhaps you could do some testing in your code to see if this object can be found and if it’s ID is the correct value.
Viewing 2 posts - 1 through 2 (of 2 total)
The topic ‘ACF in a widget’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Clients need flexibility. Developers need a repeatable workflow that doesn’t have a steep learning curve. See how digital marketing agency Noiza found both with Advanced Custom Fields in our latest case study.https://t.co/BxQAy6COJt