Home › Forums › Add-ons › Gallery Field › Load images into Gallery in code › Reply To: Load images into Gallery in code
Thanks John! I knew that, but your message sparked me to look from another angle!
I had this:
$value = array(array('ID' => '253'), array('ID' => '170'));
But, it should be this:
$value = array('253', '170');
Used this full function:
//IMAGES field
function load_team_summary_images( $value, $post_id, $field ){
global $allUpdatesImages;
$value = $allUpdatesImages;
return $value;
}
add_filter('acf/load_value/key=field_564900d0c98d1', 'load_team_summary_images', 10, 3);
Works perfectly. I am attaching the images (from a Gallery field) to the post, so I used get_attached_media('image', $oUpdateID);
with the post ID to get all the IDs of the attached media.
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.