Home › Forums › General Issues › Advanced Custom Fields in a Custom Text Widget › Reply To: Advanced Custom Fields in a Custom Text Widget
Hi @jboveri
I can see 2 issues with your code:
1. You use a variable called $author_id multiple times, yet it is not defined anywhere.
2. You use the_field without specifying a $post_id param. This is fine if you are within the loop, but I beleive your code will not have access to the global $post object, so it won’t work. You may need to add global $post
above your code, or use a function to find the ID and then use it in your the_field calls.
Does that help?
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.