Home › Forums › General Issues › update image field with image from the wordpress media library › Reply To: update image field with image from the wordpress media library
$value depends on what type of field it is. If it’s an image field then you need to supply the image ID or the WP attachment ID value.
Are you using the field_key when calling update_field()?
update_field('key_1234567890123', $attachment_id, $post_id);
You said you have a lot of images, is the image field part of a repeater field? Is it some other kind of field like a gallery field?
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.