Using a text editor, open the functions.php in the current theme directory and add the following code
Current_user_can (' contributor ') &&! Current_user_can (' upload_files '))
Add_action (' allow_contributor_uploads ');
Allow_contributor_uploads () {
Get_role (' contributor ');
$contributor-Add_cap (' upload_files ');
}
Once the above code has been executed once, the contributor's permission settings will be stored in the database, and even if you remove the above code, the contributor will still have permission to upload the file. If you want to deprive contributors of the ability to upload files, you can use the following code to replace them.
Current_user_can (current_user_can (' upload_files '))
Add_action (' allow_contributor_uploads ');
Allow_contributor_uploads () {
Get_role (' contributor ');
$contributor-Remove_cap (' upload_files ');
}
WordPress Add Contributor Upload permission