Support

Account

Home Forums General Issues Copy Image / Media Uploads to Another Page Reply To: Copy Image / Media Uploads to Another Page

  • The problem with image fields is that they store the Post ID of the image in the media library and the image does not exist in the other site and if the ID value does exist it is already used for another post. The first thing you need to do is to insert the image into the media library, get the new ID and then swap the ID from the site you’re copying from with the new ID for the site that you’re copying to.

    You’ll have the same problem with any field type that stores ID values for other WP objects including relationship fields, post object fields, taxonomy fields, etc.

    flex fields and repeaters will make a difference because you’ll need to know how ACF stores values in the DB in order to find the fields that need to be replaced with new ID values. Flex fields and repeaters are stored in a similar fashion.

    A repeater or flex field will have meta keys like
    "{$repeater_name}_{$index}_{$sub_field_name}"
    a nested repeater field will look like
    "{$repeater_name}_{$index}_{$sub_field_name}_{$index}_{$sub_field_name}"