I can’t say for certain if this is the issue but you have an outer loop which is the main loop and holds the Global $post object. You then have an inner loop with a
foreach(). Whenever you call
the_field() it will always pull from the Global $post object unless told otherwise. Your
foreach() doesn’t overwrite this ( you would need to use
setup_postdata( $slide ) ).
The solution could be, assuming you want to pull field values from the
get_posts() results is to pass the post or post ID into the function call like so:
the_field( 'main_slide_title', $slide )
the_field( 'main_slide_title', $slide->ID )
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!
© 2023 Advanced Custom Fields.