Home › Forums › Add-ons › Gallery Field › Gallery field return images IDs › Reply To: Gallery field return images IDs
There is no setting for the gallery. It returns an array of image arrays. If you want to only return an array of IDs you can do
$gallery = get_field('my_gallery_field', false, false);
the 3rd parameter tells ACF not to format the value and this causes it to return just the list of IDs
the 2nd parameter is the post ID, setting it to false just means the current post
If you are trying to get the array of image arrays and acf is only returning the array of IDs anyway, this is almost always caused by a pre_get_posts filter that is incorrectly filtering the queries that ACF does to get the images. Usually because there is not sufficient logic to rule out these queries before making modifications.
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.