View Categories

User roles and Enable Media Replace

By default, Enable Media Replace allows all users with the Administrator or Editor role to replace every single media file on the site.

If you would like to restrict this in any way or customize who can replace files, here are the instructions. Note that administrators always have permission to replace all files.  If you want to revoke an administrator’s permission to replace files, you must create a new custom role and assign that user to this new role, which will have no permission to replace media.

1) Add the following line to your wp-config.php, before the
/* That's all, stop editing! Happy publishing. */ line:

define( 'EMR_CAPABILITY' , array('edit_upload_all', 'edit_upload_user') );
2) Install the
User Role Editor plugin and go to Users > User Role Editor.
3) On the right side of the screen, click on Add Capability.

4) In the popup window where you specify the name of the capability, type edit_upload_all.

5) Repeat steps 3 and 4, but this time write
edit_upload_user.

6) Now you can specify who can replace files. The two capabilities you just added define whether the user can replace all files of all users (edit_upload_all) or only the files he owns (edit_upload_user).

Example #

Suppose you want to allow Editors to replace all files, and Authors to replace only their own files.
This is how the Editor role should look:

And this is what the Author role should look like: