Support

Account

Home Forums General Issues How to update_field with image url from external json

Solving

How to update_field with image url from external json

  • Hello,

    I’m very new to ACF. I am building a real estate website and I am pulling properties in from an external json url. I am able to create text fields in ACF and populate them using the code below:

    $field_key = "field_619f0b91770a7";
    $jmedia = $brewery->Media[0]->MediaURL;
    update_field( $field_key, $jmedia, $inserted_brewery );

    My issue is…
    In the json images are url’s. If I create an image field in ACF if will not accept the URL. If I create a text or url in ACF then gallery/slider widgets in Elementor do not recognize it.

    How do I assign an url to the image field?

    Thanks!

  • Hi @planbjz

    I had a similar issue before and came across this gem Programmatically Add Images to Media Library

    May need a little tweaking but certainly worked for my needs.

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

You must be logged in to reply to this topic.