Home Forums Backend Issues (wp-admin) Image upload response url


Image upload response url

  • Hi, when using an image field and uploading to media gallery. How can I retrieve the image url? Not by calling get_field(‘image’), since it has not yet been stored. I need to get the url before post has been saved/updated.

  • Uploading an image works differently. When you upload the file to media it is uploaded before the post is saved. The only thing that isn’t save is the ACF value which is the attachment ID.

    When is it that you want to get the value?

  • Thanks for your reply. I want to get the value (img url) when choosing the image from media gallery. While still editing the post, before save.

    I want to show a custom thumbnail. Like the thumbnail that is shown on the acf image upload field after upload.

  • ACF fields already do this, so I am assuming that you want to show it somewhere else. I can’t really help you get that done because I don’t know how. It would involve adding your own custom JS and detecting when the acf field is updated with the selected image. The ACF field would only hold the ID of the image.

  • Yes I’m listening to the load event of the img. It works but.. since they already do it, I was hoping there was some sort of response.

    Thank you John!

  • I do not know, some action is probably triggered in the ACF JS API, but I don’t know what it is.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.