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' );
    }
});

Comments on this post

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