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 thread is resolved. Here is a description of the problem and solution.

Problem: When deactivating Media translation you get each image in the Media Library duplicated to the number of languages that you have got on your site.

Solution: The solution is brought by the user in this thread: https://wpml.org/forums/topic/deactiving-the-wpml-media-translation-plugin-created-many-duplicates/#post-878730

Relevant Documentation: https://wpml.org/forums/topic/deactiving-the-wpml-media-translation-plugin-created-many-duplicates/#post-878730

This topic contains 11 replies, has 4 voices.

Last updated by jernejO 3 years, 5 months ago.

Assigned support staff: Itamar.

Author Posts
April 30, 2016 at 6:53 am #872466

Johnny

Ever since I started using WPML, I had the WPML Media Translation plugin installed.
But the thing is I never used it. What I've always done was upload a new image file for every post. And I did this for SEO purposes.

Example:
- English post would get it's own image file: "english-image.jpeg"
- French post would get it's own image file: "french-image.jpeg

And since I was duplicating images manually and never used the plugin's capabilities, I decided to deactivate it!

Well as soon as I did that, I noticed a major problem in the media library. It duplicated every image entry in the library exactly 8 times. So basically, I see 9 copies of every image...but there's only one file uploaded, it's just that it's referenced 9 times. I did check the FTP, and luckily, the images were not duplicated.

Please look below for screenshots of my media library BEFORE...and AFTER I deactivated the plugin. (Luckily, I took screenshots figuring this might be a problem.)

Please help..how do I get rid of those duplicate entries?

May 2, 2016 at 2:37 pm #873308

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Johnny.

Thank you for contacting the WPML support forum.

Indeed, when you turn off the WPML Media plugin, then you can see a reference to each attachment entry in the DB.
It is multiplied by the number of languages that you have active on your site.
You are right that it is only a reference and not a duplication of the file itself.

What I can suggest you in case that you want to leave the WPML Media plugin deactivated is the following.
A. Temporarily reactivate the WPML Media plugin.
B. While in the Media Library admin page switch to a nondefault language.
C. Switch the view to a list view.
D. Choose all images and bulk delete them.
F. Repeat this for every nondefault language.
*Important! Do not do it in the default language or you will lose all reference to your images attachments*
G. Deactivate WPML Media and you will not see those duplications that were apparent before.

******IMPORTANT MAKE SURE TO BACKUP YOUR SITE BEFORE DOING THAT******

Please let me know if the above solution works for you, I look forward to your reply!

Thanks,
Itamar.

May 2, 2016 at 3:02 pm #873343

Johnny

Thank you so much for the reply, Itamar!

Quick question: what do you consider as the "DEFAULT LANGUAGE"?

- Does it mean the default language for WPML? (which is English for me)
- Or default language that you used to upload the image. (Since I upload russian images to russian language, french images to french language, etc...I worry in this case, the default language would be the one used to upload the image.)

May 2, 2016 at 3:28 pm #873374

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Johnny.

What I meant by "DEFAULT LANGUAGE" is indeed the WPML default language (English in your case).

If you have different images for each language, it may be that you will need to select manually under each language the images that are not the ones that belong to that language and then delete them.

If you have hundreds of images, that may be tedious work.
In that case, I would suggest you just to leave WPML Media activated.
If this does not cause you any problem I see no reason to turn it off.

Please let me know if you need further info about this.

Thanks,
Itamar.

May 2, 2016 at 3:36 pm #873387

Johnny

I only disabled the plugin because I'm doing a WP cleaning and want to avoid having unnecessary plugins running. It makes life so much easier for me and other programmers when troubleshooting issues and knowing what is critical and what is not.

May 4, 2016 at 7:14 am #874736

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Johnny.

I'm sorry, but I did not understand from your last reply whether you still need help from me with this issue?

If your issue is solved, I would kindly like to ask to mark this thread as resolved.
And if it is not solved, please let me know how can I further assist you with this issue?

Thanks,
Itamar.

May 4, 2016 at 7:33 pm #875488

Johnny

Hi Itamar,

I'm trying to do it and it is not easy. Give me some time, please. And perhaps I'll be able to come back with helpful tips for everyone else doing the same.

Thank you!

May 4, 2016 at 8:27 pm #875522

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi, Johnny thanks a lot!

It is really inspiring that you want to help all other users in this forum.
I'll wait patiently for your reply but please keep in mind that our system automatically closes the threads if no reply is added after 28 days.

Thanks,
Itamar.

May 9, 2016 at 11:59 pm #878730

Johnny

Hi guys...I fixed it. Here's what I did to get rid of duplicates after removing the plugin....

1) Back-up your site. And uncompress the "wp-content/UPLOADS" to be ready for some manual copying of images.

2) DE-ACTIVATE the WPML Media Translation plugin.

3) Install "Force Regenerate Thumbnails" plugin, this one is the best. https://wordpress.org/support/view/plugin-reviews/force-regenerate-thumbnails

4) Go into your Media Library and sort by all unattached files and delete them. (This is assuming you only have one image per article. If you have more than one, then the other images will be unattached and should not be deleted.) Only the originals should remain at this point and not the duplicates. On some articles...this won't work if all your images are showing up as unattached and the main ones are showing any particular attachment to its article.

5) You'll probably lose all your images on the FTP. Copy them back with your backed-up uploads folder. It'd be best if you can copy only the main images and not the thumbnail versions, use the plugin to regenerate the thumbnails.

6) Use the Force Regenerate Images plugin to regenerate all thumbnails, this process is important not only for creating thumbnails but to re-link your images in FTP to the media library items.

May 22, 2016 at 3:57 pm #887678

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Thank you Johnny, for posting this solution here.

April 19, 2017 at 12:28 pm #1257062

Darius

Hi Johnny,

but this wont work for other media types like PDF, right?

best,
Darius

August 29, 2019 at 12:31 pm #4480861

jernejO

Just if it helps someone, for me nothing else worked properly, so I had to write a custom MySQL command that solved it. If it helps someone, great: hidden link