Home › Forums › Bug Reports › get_field() resets $post? › Reply To: get_field() resets $post?
I just did a quick test. I don’t have the same post types you have I just used posts. This is on a site that only has ACF active. The same post is output before and after using get_field()
, so I’m not seeing anything in ACF.
Unless it has to do with the specific field you’re getting. What type of field is 'mod'
?
$args = array(
'post_type' => 'post',
'order' => 'ASC'
);
$items = get_posts( $args );
foreach( $items as $post ) {
setup_postdata($post);
echo 'BEFORE<pre>'; print_r($post); echo '</pre>';
$field = get_field('test_field');
echo 'AFTER<pre>'; print_r($post); echo '</pre>';
}
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.