How to restrict WordPress media library access to user’s own uploads

By default, WordPress allows authors/users to see all images uploaded to a WordPress site’s media library. This could be a problem if your site has users with individual images/galleries. This WordPress snippet will allow you to restrict WordPress media library access to user’s own uploads.

Instructions
Add this code to your WordPress theme function.php file.