It is pretty cool how wordpress manages user and restrict access via defined roles but one of the critical part of the website are the images. Once you give access to your editors they will have capability to view and delete images even if they are not uploaded by them which will ruin the pages and posts that are using it. On some points you don’t want the site users, freelancers or even general public to access the images. Well then you came to the right page
This tutorial also covered the ability to hide the posts that are created by other users so that the current users cannot make any changes.
First you need to be able to access the editor by navigating to Appearance > Editor and find the theme’s functions.php
That’s great you have the required access 😉
Add the code below which will hide the posts and images uploaded by other users except for administrator on /wp-admin/edit.php and /wp-admin/upload.php
Easy isn’t it? Now we need to be able to hide the images when the user click the ‘Add Media’ button above the wordpress editor. Which is pretty much easy too by adding this code :
Works like charm! Special thanks to @timocouckuyt for providing that code on this forum post.