• Hi all,

    maybe anyone can help with a problem I’m currently experiencing.
    Whenever I completely delete images from the backend some image files stay on the Server in the uploads directory. First I thought it had something to do with WPML because I need to delete images from every language specialty for them to be completely gone from the server but after deleting an image from every language there are always still some files present on the FTP but not the backend.
    Has anyone an idea why this is happening?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator bcworkz

    (@bcworkz)

    WP is configured to ignore server errors due to file deletion failures, so no clues are left for us to investigate. You could temporarily alter the responsible code line to allow deletion errors to be logged. Hopefully the logged errors will give us some clue about the problem. OTOH, the logged error message could be similar to “file deletion failed” and not offer any clue about the reason. IDK, I’ve not encountered such errors before. It’s relatively simple to give it a try at least.

    In the /wp-includes/functions.php file, search for “@unlink” in the file. The one we want is in the wp_delete_file() function declaration, it should be at line 7337. Remove the @ from unlink. Save the altered file. When the problem recurs, check your error log for related messages.

    You should restore the @ when you’re finished investigating. The next WP update may restore it for you if you don’t do it yourself.

    Thread Starter gerryj

    (@gerryj)

    @bcworkz Ok, I did that but sadly I didn’t find any errors regarding the deleting of images. I’m still not sure that It doesn’t have anything to do with WPML and the multiple languages.

    Moderator bcworkz

    (@bcworkz)

    Are you able to discern if the sizes left relate to any specific plugin or theme? Any sizes besides the default thumbnail, medium, and large sizes defined on the media settings screen. If something saved images outside of the standard WP routine, WP wouldn’t have the size registered and wouldn’t know to delete it with the rest. Or the images could have been saved with odd permissions so that WP is unable to delete them.

    Another possibility is the server is very busy and is dropping random delete request packets. Your hosting cPanel might have a metrics view showing graphs of recent server performance. If the error rate increases (or other resources are maxed out) while you do a bulk delete, this could be what’s happening.

    Thread Starter gerryj

    (@gerryj)

    @bcworkz Ok, I Tried to delete another Image and these sizes are still left on the server.
    – 160×160
    – 300×300
    – 600×594

    I know 300×300 is the medium size but I don’t know the other two.

    I’M unsure if a plugin or theme could have caused this.
    These are the currently installed plugins:
    Accordion Blocks
    ACF QuickEdit Fields
    Advanced Custom Fields
    Advanced Custom Fields Multilingual
    Antispam Bee
    Counter Block
    Custom Permalinks
    Email Encoder – Protect Email Addresses
    Enable Media Replace
    GenerateBlocks
    GenerateBlocks Pro
    German Market
    GP Premium
    Health Check & Troubleshooting
    HTTP-Header zur Verbesserung der Webseiten-Sicherheit
    iThemes Security
    Lazy Load for Videos
    Lightbox for Gallery & Image Block
    LiteSpeed Cache
    Page Links To
    PHP native password hash
    ProfilePress
    Really Simple SSL
    Redirection
    Schema Pro
    Search & Filter Pro
    Shariff Wrapper
    Simple History
    UpdraftPlus – Sichern/Wiederherstellen
    User Role Editor
    Very Simple Event List
    WCK – Custom Fields and Custom Post Types Creator
    WooCommerce
    WooCommerce Multilingual & Multi-Currency
    WP Disable
    WPML CMS Nav
    WPML Media
    WPML Multilingual CMS
    WPML SEO
    WPML String Translation
    Yoast SEO
    And I’m using the theme Generatepress

    I’m still checking with the Hosting Prover, because of the performance.

    • This reply was modified 2 years, 4 months ago by gerryj.
    Moderator bcworkz

    (@bcworkz)

    The only way to narrow down a plugin or theme as the cause is if you can reliably induce the problem to happen on demand. You can then do a process of elimination by deactivating likely candidates. If it only happens randomly, it’s almost certainly a server resource issue.

    If WP is unable to delete a default size, it eliminates improper registration as the reason, but that does not mean the problem is not due to a plugin or theme conflict.

    Thread Starter gerryj

    (@gerryj)

    @bcworkz I deactivated all plugin and switched to the parent theme and the error still persist. I’m pretty sure now that this is a server issue.

    I’ll get back to you after I get feedback from the hoster.

    Thread Starter gerryj

    (@gerryj)

    @bcworkz Our Hoster can’t detect any problems with the Server.
    They are guessing that it has something to do with a runtime error, but I’m not so sure.

    The WP installation is quite large by now, over 36 GB, maybe this causes the problem?

    Any other ideas maybe?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can’t delete images properly’ is closed to new replies.