Support

Account

Home Forums General Issues My fields are not looping with my get_posts foreach loop Reply To: My fields are not looping with my get_posts foreach loop

  • You are outside of the normal WordPress loop so you have to pass the ID to your get_field function like this:

    foreach($myposts as $mypost) {
    
        echo get_field('myfield', $mypost->ID);
    
    }