Home Forums General Issues Save an Image using code, not GUI? Reply To: Save an Image using code, not GUI?

  • Saving an image from a URL to an attachment in the media library is not an easy thing to do and there are several plugins that focus on doing just this one thing. Examples and Here is topic on stack on the subject You might be able to use these as examples.

    Also, the ACF image field stores and attachment ID and not a URL, so you would need to have 2 fields, the first to hold the URL and the second to hold the ID. Or if you’re getting the URL from some other source than an ACF image field then you’d need just the image field to store the ID of the imported image.

    In either case, you would need to go through the process of importing this image into the media library and then once that is done you get the new attachment ID and set it to the ACF field using update_field(). But importing images from URLs is way beyond what ACF can do.