Support

Account

Home Forums ACF PRO Populate a file field with the value of a text field

Solved

Populate a file field with the value of a text field

  • Hello,

    We have been using a text field for adding links to files to download for a while and now we want to rearrange them as file fields.

    All the files we are linking on are uploaded to the media library.

    Is there a simple way to populate the new file field with the data of the text field so that we do not lose the data?

    I am considering getting attachment ID by its URL that the text field contains, getting all the necessary attachment data by its ID and then use update_field() to update the file field with it, but am not sure how to use update_field() with the file field.

    Regards,
    Igor

  • The file field only contains the ID, so you don’t need to do the last step. Only getting the id by the url and then updating the field with that ID.

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

The topic ‘Populate a file field with the value of a text field’ is closed to new replies.