Hi in this tutorial we are going to learn how to make Allow to see only the media files and images uploaded by the user in wordpress.
global $current_user, $pagenow;
$is_attachment_request = ($wp_query_obj->get(‘post_type’)==’attachment’);
if( !$is_attachment_request )
if( !is_a( $current_user, ‘WP_User’) )
if( !in_array( $pagenow, array( ‘upload.php’, ‘admin-ajax.php’ ) ) )
if( !current_user_can(‘delete_pages’) )
$wp_query_obj->set(‘author’, $current_user->ID );
Please provide your valuable comment to make the site more useful.
Thanks for reading