How To Restricting Users To View Only Media Library Items They Upload In WordPress

By default, WordPress allows every author to view all the images in media library, which isn’t a great idea, right? Adding this snippet to WordPress’ current theme’s functions.php file will restrict users to view only media library items they uploaded in the library.