• hello,

    i have a big csv file with a lot of absolute image urls. the according images i already uploaded in the media library.

    i created a custom post type with several acf image fields in which i want to store the urls. but unfortunately that doesn’t work out of the box, i suppose the acf image field doesn’t accept the url as a correct value. what should i do to change that?

    (i also have other acf fields in that custom post type and the according text-data i well imported, so i generally know how to import dcsv-data to acf-fields with the acf-field-key.)

    best regards
    philipp

    https://www.ads-software.com/plugins/really-simple-csv-importer/

Viewing 1 replies (of 1 total)
  • Thread Starter p_niedrich

    (@p_niedrich)

    i figured out that i have to use the image id to update the acf-image field. i tried this customization but without success:

    function really_simple_csv_importer_save_meta_filter( $meta, $post, $is_update ) {
    $attachment_url = $meta[‘field_55f2be2a39177’];
    $image_id = pn_get_attachment_id_from_url( $attachment_url );
    // function to retrieve the image id that i need for the update_field()
    $field_key = “field_55f2be2a39177”;
    update_field($field_key, $image_id);
    return $meta;}
    add_filter( ‘really_simple_csv_importer_save_meta’, ‘really_simple_csv_importer_save_meta_filter’, 10, 3 );

Viewing 1 replies (of 1 total)
  • The topic ‘Problem with url import to acf image field’ is closed to new replies.