Home › Forums › Add-ons › Gallery Field › Random Gallery Image with wp_get_attachment_image() › Reply To: Random Gallery Image with wp_get_attachment_image()
Another option is to get the unformulated value from ACF. Since you’re going to generate the image yourself using wp_get_attachment_image(), there really is not point in having ACF do all the queries involved to get all that image data that you’re not going to use.
$images = get_field('gallery', 'option', false);
will return an array of image IDs
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.