Generally , due to this code $wp_query->set(‘author’, $current_user->ID); the custom fields of Advanced Custom Fields ( acf ) got hidden. So i have used this following code to solve the issue. So if you use this code in function.php or using code snippet plugins, Author can see only his uploaded images instead of all users image.
function restrict_author_media_library($wp_query) {
if ( $wp_query->get('post_type') == 'attachment' && current_user_can('author')) {
$current_user = wp_get_current_user();
$wp_query->set('author', $current_user->ID);
}
}
add_action('pre_get_posts', 'restrict_author_media_library');
