WP Manifestindependent plugin directory
manifest / media / delete-attachments

Delete Attachments GitLab

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitLab with WP-CLI:

wp plugin install https://gitlab.com/filipvanreeth/delete-attachments/-/archive/main/delete-attachments-main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Delete Attachments WordPress Plugin

This plugin allows you to delete files attached to a post or page from the media library.

Filters

You can use the delete_attachments/delete to add your own functionality when an attachment is deleted.

The filter has two parameters:

  • $attachments - An array of attachment IDs to be deleted
  • $posts - An array of post IDs that the attachments are attached to

Example

function my_delete_attachment_function($attachments, $posts) {
    // Do your stuff.
    return $attachments;
}

add_filter('delete_attachments/delete', 'my_delete_attachment_function', 10, 2);