Allow Vendors to Delete Their Media Files

This snippet does what it says… it allows vendors to keep their own files organized by removing the unnecessary images. Why this is not default? I’m not sure.

As always, this is either added to your Child Theme’s functions.php file, or consider using the My Custom Functions Pro plugin to manage and organize all your snippets.

add_action( 'admin_init', function() {
    $vendor = get_role( 'dc_vendor' );

    if ( ! $vendor->has_cap( 'delete_posts' ) ) {
        $vendor->add_cap( 'delete_posts' );
    }
});

Tested and working on Woocommerce 4.6.1, WCMp 3.5.10

Is this no longer relevant or not working? Please let us know in the comments!

Comments on this post

Your email address will not be published. Required fields are marked *