This will lock uploads to “Uploaded to this post” and will not show “All media items” or other options in WordPress media panels.
Add this code to your function.php file
add_action( 'admin_footer-post-new.php', 'firmasite_mediapanel_lock_uploaded' );
add_action( 'admin_footer-post.php', 'firmasite_mediapanel_lock_uploaded' );
Ah, you've discovered attachments :)
The media library isn't a file browser, and things that get put in the uploads folder don't just appear in the media library either. Did you never wonder how WordPress stored the titles and captions for images?
When you upload a photo, aside from the physical file, WordPress creates a post of type attachment. As we know,...