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 10 replies, has 2 voices.

Last updated by Marcos Vinicios Barreto 3 weeks, 2 days ago.

Assigned support staff: Marcos Vinicios Barreto.

Author Posts
May 14, 2019 at 6:43 pm #3809995

timothyH-6

I am trying to: delete a media item
I expected to see: the media item deleted in all languages
Instead, I got: the media item was only deleted in the primary language

When the media translation feature came out, we used the "Translate existing media in all languages" option. We did not use the "Duplicate existing media for translated content" option.

I reviewed other items in the support forum, and found two recommendations.
1) Make sure that "When deleting a post, delete translations as well" is enabled and this will delete the translations when the primary language media item is deleted - it is enabled, and the translations are not being deleted
2) Disable "When uploading media to the Media library, make it available in all languages" - because we use ACF, we have a couple complex pages that are not linked translations, and this makes it so the images used on those pages aren't available in the other languages unless they're re-uploaded in each language

Note: this originally occurred on our production site, we disabled the "When uploading media to the Media library, make it available in all languages" option. But today we discovered the broken image issue, so we need to get this working properly. I've been experimenting on our dev site to attempt to fix the issue.

May 15, 2019 at 12:40 am #3811207

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for contacting WPML Support. Can you please, try to remove it directly from your WordPress Dashboard > Media settings? When doing so, do you still see the media item in the other languages? You can also remove the duplicated media item in a language basis from your Media Library. Please, let me know if it helps, have a nice day.

May 15, 2019 at 6:07 pm #3819361

timothyH-6

I'm not sure what changed between yesterday and today, but today when I remove a file from WordPress > Media Library from the English language (where it was uploaded), it does remove all instances in the Media Library in other languages. (It appears as if yesterday I may have not been in the English admin).

However, the media file itself does not get removed from the server, even though there are no references to the file left in the database. Is there a fix for this?

May 15, 2019 at 6:43 pm #3819635

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. Please, make sure the following:

1 - You have checked the option 'When deleting a post, delete translations as well' from your WordPress Dashboard > WPML > Settings > Posts and pages synchronization.

2 - Now upload a test image and try to delete it again and let me know if it is also deleted from your wp-content/uploads folder.

See: https://wpml.org/documentation/getting-started-guide/media-translation/

Please, let me know if it works. Have a nice day.

May 15, 2019 at 6:49 pm #3819747

timothyH-6

Yep, as I mentioned in my initial post, that option is checked. See screenshot.

When I look in the database, in the wp_posts table, there are five copies of the post entry for the media file, one entry for each language. When I delete the file from the English admin, I do see that all five copies of the post entry are deleted from the database. But the file remains in wp-uploads.

When I re-upload the file, the filename gets appended with -1, since the file is still in wp-uploads.

May 16, 2019 at 5:41 pm #3828459

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. I took a look at some related topics and noticed a workaround for it is to delete the media item in every language from your WordPress Dashboard > Media, after it is deleted in all the languages the actual file in wp-content/uploads folder will be deleted too. Can you please confirm this behavior? Thank you for your collaboration, have a nice day.

May 16, 2019 at 6:03 pm #3828687

timothyH-6

Unfortunately that's not possible... when the 'When deleting a post, delete translations as well' setting is set, and you go to WordPress Dashboard > Media and delete the media item, it is then deleted from the Media Library in all languages. So there's nothing left to delete from other languages. But the file still remains.

May 17, 2019 at 5:33 pm #3836257

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Please, take a look at my private reply above. Thanks!

May 22, 2019 at 7:50 pm #3868913

timothyH-6

Hi,

I reviewed your private message. I logged into the sandbox environment you provided and uploaded a test PDF file (TestPDF.pdf), and then deleted it. When there was only one language, the one that you created (Portuguese/Brazil), it appeared to work just fine.

I then went to WPML->Languages and added additional languages: French, German, Italian, and Spanish. And I re-uploaded the test PDF. And then deleted it. After the additional four languages were added, when deleted from Media Library, the PDF file remained on the sandbox server -- I was able to still access it directly via URL after deleting the file. And, when I uploaded it again, "-1" was appended to the filename (TestPDF.pdf --> TestPDF-1.pdf) because the original file was still there.

So, based on this, it sounds like this might be a bug when there are more than two languages? I left the sandbox site in this state, with 5 languages, and the -1 test PDF file uploaded, so that you could review.

Thanks for your help.

May 24, 2019 at 1:41 am #3880051

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the details. I took a further look and indeed it doesn't work properly when more than two languages is added, this is why I forwarded your ticket to our second level support. I will update you here as soon as I get some more details from them. Thank you for your understanding and patience, have a nice day.

May 24, 2019 at 2:12 pm #3885485

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for your patience while waiting for a solution. This is a know bug already reported to our development team, although I am not able at the moment to estimate when it will be fixed. For now, you can try to manually remove the media from your wp-content/uploads via FTP as the only viable workaround. I will update you here as soon as a fix is available. Thank you for your understanding and patience, have a nice day.