We have just released WPML 4.3.3. Before reporting issues please make sure to update - this version resolves all known issues with the major WPML 4.3 release

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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:
How to bulk remove media duplicates
Solution:
1) Go to the media version where you want to delete the files (change the media library language by changing dashboard language)
2) select "Bulk selection"
3) add this code in the browser console:

 jQuery('ul.attachments.ui-sortable.ui-sortable-disabled li').click();

4) delete all the files

This topic contains 2 replies, has 2 voices.

Last updated by Johnny 4 months ago.

Assigned support staff: Bruno Kos.

Author Posts
June 20, 2019 at 6:50 pm #4062611

Johnny

Tell us what you are trying to do?

We are trying to remove a language (Norsk) from our website and there are over 2,600 media files associated with this language.

Can I just remove the entries from the wp_icl_translations table instead of having to remove them via the Media Manager in WordPress?

(e.g. DELETE FROM wp_icl_translations WHERE element_type = 'post_attachment' AND language_code = 'no' )

In addition, could I do this with other element types ( post_page, text_nav_menu, etc. )

Thanks for your help!

June 21, 2019 at 8:33 am #4065495

Bruno Kos
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hi,

Thank you for contacting WPML support!

I have performed some tests and discussed this with my other colleagues. I believe that this is known to you already - that WPML media translation does not create physical duplicates, but only entries in database:
https://wpml.org/forums/topic/wpml-duplicate-image-issue-images-does-not-appear-on-other-languages/#post-2584600

But as for these entries, when you duplicate media it would end up at least in following tables:
- wp_posts
- wp_postmeta
- wp_icl_translations

As you can see, creating a SQL query that would delete them all at once would be very difficult, because you would not only be deleting entries from one table, but would have to find a way to identify these entries within other - WordPress default - tables and then delete them.

Therefore, the fastest and definitely most safest solution would be doing the following:

1) Go to the media version where you want to delete the files (change the media library language by changing dashboard language)
2) select "Bulk selection"
3) add this code in the browser console:

 jQuery('ul.attachments.ui-sortable.ui-sortable-disabled li').click();

4) delete all the files

As for doing it for posts or pages, you can also change the admin language when on any of these locations and deletes them from there, as these are first and foremost regular WordPress posts/pages/etc, while WPML tables only create connections between them.

Regards,
Bruno Kos

July 12, 2019 at 5:52 pm #4200765

Johnny

Thank you Bruno, your solution worked for me and I appreciate you taking the time to help!