Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 8 replies, has 2 voices.

Last updated by Bigul 11 months ago.

Assigned support staff: Bigul.

Author Posts
October 15, 2019 at 9:00 pm #4760521

per-egilR

I am trying to: Copy attachment custom metadata (post meta) from the original attachments to the translated attachments. The metadata contains copyright, license, GPS, etc. information for each image.

When I select "Translate existing media in all languages" on the section WPML > Settings > Media Translation and press "Start", all attachments are copied to the additional languages. So far so good. But the attachment custom metadata is not copied to the translations.

I tried setting the metadata to "Copy" on the section WPML > Settings > Custom Fields Translation, but that didn't have any effect.

October 17, 2019 at 7:11 am #4770569

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue. Sorry for the delay in response. It is not normal here.

Please activate the WPML Media Translation plugin after site backup, then update the Media item in the default language and check you are getting the expected result or not.

Also, please check these Custom Fields has any related systems fields. To find the systems fields visit WPML>>Settings>>Custom Fields Translation and click on *Show system fields* link.

--
Thanks!

Bigul

October 17, 2019 at 1:11 pm #4773891

per-egilR

Hello Bigul,

Thanks for your reply.

WPML Media Translation is not an option as I don't need images (only metadata) in different languages. If this is the only solution, I'll rather do without.

The metadata in question are not system fields and are not related to system fields. However, they are stored as an array. Is that an issue?

October 17, 2019 at 3:08 pm #4775257

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello,

Thank you for the updates. It requires further checking. How you are managing these metadata for the Image files.

If possible can you please reproduce the issue in our test site(with only required plugins). Please check the following URL. It is a fresh installation of our Sandbox server. It helps us a lot.

hidden link

Please note, WPML Media will only create an extra entry into the database to handle the media in the secondary language. It will not create a physical duplicate of the media file.

--
Thanks!

Bigul

October 17, 2019 at 3:34 pm #4775517

per-egilR

Hello Bigul,

Thanks for providing the sandbox. I have added the plugin "Photo Credit" and three test images. The plugin adds several custom fields (Copyright, Credit, Source, etc.) to "Attachment Details". I have entered som test data to the English versions of the images, and then started Media Translation. The metadata is visible on the English images but not the German ones.

The metadata is stored as one array in the custom field "photo_credit_credit" using update_post_meta.

October 18, 2019 at 6:29 am #4778723

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello,

Thank you for reproducing the issue on the Sandbox test site. The issue is existing on my local copy after the initial checks. Therefore I have escalated the ticket to our compatibility team for further checking. We will get back to you soon. Please wait.

--
Thanks!

Bigul

October 18, 2019 at 3:44 pm #4784167

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello,

We are getting the expected result on our test site after the following steps. Please try this workaround after a site backup and let me know your feedback.

1) Please add the following code in functions.php of your theme

add_action( 'add_attachment', 'wpml_sync_media_custom_fields' );
add_action( 'edit_attachment', 'wpml_sync_media_custom_fields' );
function wpml_sync_media_custom_fields( $post_id ) {
    do_action( 'wpml_sync_all_custom_fields', $post_id );
}

2) Save the changes
3) Then update the Media file in the default language(just resave). Please check the attached images for more details.

Please note, our developers are working on this feature and it will be included in a future release of WPML. But it will take some time.

--
Thanks!

Bigul

October 19, 2019 at 10:05 am #4787197

per-egilR

Hi Bigul,

Thanks, that is a nice solution when updating attachments, but it only partially answers my question.

I have 1000+ images on my site, and I don't really want to manually iterate over all of them to get the custom fields copied to the translations.

I was hoping for a solution where the custom fields were copied over when pressing "Start" with "Translate existing media in all languages" on the section WPML > Settings > Media Translation (see wpml-02.png). And also to control which fields are actually copied over using the settings in "Custom Fields Translation" (see wpml-01.png).

October 21, 2019 at 7:20 am #4791693

Bigul
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello,

Thank you for the updates. Happy to know the temporary fix is working for you. For your kind information, our developers are still working on this issue. But right now I don't have the exact time frame required for the fix.

Please note, the Photo Credit has a WPML language configuration file. So it is setting the translation preferences for the Photo Credit custom fields. That is why it is showing as locked in WPML>>Settings>>Custom Fields Translation section.

Please check the attached image and the following documentation for more details.

https://wpml.org/documentation/support/language-configuration-files/

https://wpml.org/documentation/support/language-configuration-files/#custom-fields

--
Thanks!

Bigul

The topic ‘[Closed] Media (attachment) metadata not copied to media translations’ is closed to new replies.