• Resolved elcorriol

    (@elcorriol)


    Hi,

    I’m trying this plugin, but i had a problem.

    When i remove a custom post type it removes the images from media, but if i go to the uploads folder it still appears on the server.

    How could i remove this images from server too?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    Hello, elcorriol!

    Did you remove your post types from Trash? No media files are removed until you clear your Trash. If you did that already, it sounds like a problem caused by your theme.
    I’ve seen this happen in the past with themes that use custom scripts to generate images on-the-fly. If your theme does this and WordPress doesn’t track your newly generated image sizes, you have a serious problem:

    – All those custom sizes generated on the fly will become orphaned files on your server with no way of removing them through your dashboard. Even if you delete the files from your media library those custom sizes will remain on your server because they are not recognized by WordPress. You will have to remove them by hand, through FTP.
    – Even if the script does a proper cleanup (which I doubt it does), the removal of those thumbnails will stop working the moment you switch to another theme.

    What do you see when you check the uploads folder after removing an image via the WordPress dashboard? Do you have all image sizes left on the server or only specific custom sizes?

    Thread Starter elcorriol

    (@elcorriol)

    Hi,

    Thanks for your response.

    I think that the problem is related to WPML, until i do not delete images on both languages it do not remove from server.

    The plugin is compatible with WPML? Or i could modify something in order to delete the images in both languages?

    Thanks.

    Plugin Author Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    I don’t have a lot of experience with WPML, but there shouldn’t be any conflict.
    As far as I know, WPML stores each translation as a different post, with a different ID, so you need to check what is the actual parent of your images. You can check this quickly in the Media Library, in list view. The images will be removed only when the parent post is deleted. Depending on how you upload your images, the translation you are removing might not be the parent post.

    Take this scenario:
    Post X is translated into language A (ID 100) and language B (ID 101).
    When you upload your images while writing in language A, the parent of your attachments becomes ID 100. If you remove language B, your attachments won’t be removed because the plugin looks for child attachments for the post with the ID 101. They will only be removed when you delete the translation in language A, when the returned ID is 100.

    Unfortunately, in WordPress, a media file can have only one parent and there’s no way of checking if an image is used in multiple posts without huge performance hits. It would mean doing multiple serialized scans of your database for EACH media file in your media library. And that would cause timeouts on most websites, especially for those on restrictive hosts.

    Thread Starter elcorriol

    (@elcorriol)

    Hi,

    I already solve the problem.

    In WPML there is an option to delete all translations when a post is deleted in one language.

    I activate this option and now is all working.

    Thanks for your assistance

    Plugin Author Eusebiu Oprinoiu

    (@eusebiuoprinoiu)

    My pleasure. I’m glad to hear you found a fix!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Images removed on media but not on server’ is closed to new replies.