Home › Forums › Bug Reports › get_field() resets $post? › Reply To: get_field() resets $post?
That is what i tried to show in first post:
1. In custom page template file (so global $post variable is set already) i create secondary loop using get_pages() (btw using WP_Query doesnt change anything).
2. I iterate through get_pages() results and use setup_postdata() to set global variables up.
3. Right before get_field() call i check $post value and its correct. Right after the call i check $post again and see that now it holds value of global $post.
4. Whole this thing seems happens only on first iteration. The rest of the loop data seems correct.
Finally if im commenting out get_field() call then $post values are correct for entire secondary loop. So i am pretty sure that whole this thing has something to do with ACF 🙂
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.