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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

Tagged: 

This topic contains 8 replies, has 3 voices.

Last updated by Bruno Kos 1 year, 3 months ago.

Assisted by: Bruno Kos.

Author Posts
February 26, 2023 at 11:42 am #13116499

Dimitri

Hello,

I'm using the following plugins:
- WPML Sitepress
- WPML all import
- WPALLIMPORT

I discover that the wordpress function "wp_delete_attachment" do not works correctly when WPML is active. It looks like WPML apply a filter on "wp_delete_file" and do not allow the wordpress function "wp_delete_attachment" to delete files on disk. The function removes correctly the media in the wordpress media library but DO NOT DELETE files on disk. I have thousands of orphan files and many gigabytes lost on the disk.

To be more precise, if I use this function to send media files to trash ""wp_delete_attachment( $file->ID, false );"" and I empty the trash after, files are correctly delete from the file system. BUT, if I ask to delete files immediately like "wp_delete_attachment( $file->ID, true );", files remains on the disk.

The same behavior occurs when I setup WPALLIMPORT to delete files.

I'm wondering how to fix this behavior.
It would be nice if WPML could fix that in a future release.
WPML shouldn't change the behavior of a native wordpress function when it is called thru a plugin or the file functions.php in the child theme .

I'll send the link of this ticket for information to WPALLIMPORT author.

Thank you for your help.
Dimitri

February 27, 2023 at 8:37 am #13120375

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

Hi,

Thank you for contacting WPML support!

Can you check and confirm that the issue you are having is this?
https://wpml.org/errata/wpml-all-import-images-are-not-deleted-from-the-upload-folder-when-updating-posts/

Regards,
Bruno Kos

February 27, 2023 at 10:00 am #13121719

Dimitri

Hello,

Yes, I confirm.

I've made deep investigation and you should ask your DEV team to search the bug around filters applied on "wp_delete_file".

It is not only WPALLIMPORT who can not erase files on disk but also when I call the PHP function "wp_delete_attachment". I guess that the root issue is around those filters.

I also found an article on stackexchange written 8 years ago explaining the issue: https://wordpress.stackexchange.com/questions/181496/wp-delete-attachment-doesnt-delete-images-in-wp-content-uploads.

I have another issue with WPML all import but I will open a new ticket to report it.

Regards

February 27, 2023 at 10:44 am #13122631

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

Hi,

Thank you for confirming!

This issue has been escalated to WPML developers.

I will keep this thread updated as soon as I get any new information from them!

Regards,
Bruno Kos

March 30, 2023 at 12:59 pm #13367491

Dimitri

Hello,
Any chance to have a fix soon ?
Regards

March 30, 2023 at 1:16 pm #13367595

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

Hi,

I do not see any movement yet so can't say when will this be tackled and how.

Regards,
Bruno Kos

May 13, 2023 at 5:25 am #13639665

davidF-70

I am not sure if the option "When deleting a post, delete translations as well" has an influence on this?!

July 6, 2023 at 2:59 pm #13961387

Dimitri

@bruno-k Hello,
Do you have any news for this ticket ?
Regards

July 7, 2023 at 6:55 am #13964717

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

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

Hi,

The issue is within developers' queue, but when and how it will be handled, I'm afraid I cannot tell as I have no such information, it is up to developers to decide.

Regards,
Bruno Kos