Support » Plugin: WP Offload Media Lite for Amazon S3, DigitalOcean Spaces, and Google Cloud Storage » Plugin breaking the wp_delete_attachment() functions

  • Resolved Harry


    Steps to reproduce:

    1) Turn on Remove Files From Server
    2) Now upload an image to wp.
    3) Now create a php file and use this this:

    wp_delete_attachment(377, true);

    4) replace 377 with the uploaded attachment id.
    5) Run the script in PHP-CLI

    You MUST run it via PHP-CLI

    Results: The attachment won’t delete.

    Expected Results: Delete the attachment as well from the bucket.

    • This topic was modified 11 months ago by Harry.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Harry


    FYI: wp_delete_attachment() works fine when S3 Offload is not active.
    But if it’s active then wp_delete_attachment() does not work, specially when using external script in PHP CLI.

    • This reply was modified 11 months ago by Harry.
    • This reply was modified 11 months ago by Harry.
    Plugin Contributor ianmjones


    What’s the error?

    debug.log stack trace?



    Hello, sorry for the delay response.
    I actually traced back what was causing this issue.

    My theme has was actually disabling delete_attachment function via do_action if the user does not have enough permission.

    So, that’s why wp_delete_attachment was not working when using script through PHP-CLI because then the script did not have certain permission.

    Disabling the function resolved this issue. This ticket has nothing do with this plugin.

    Marking this ticket as resolved.

    Plugin Contributor ianmjones


    Thanks for letting us know, much appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin breaking the wp_delete_attachment() functions’ is closed to new replies.