If you want to hide the Media Library submenu:
you can do it via the admin_menu
action:
function wpse85351_hide_submenus() {
if(!current_user_can('edit_posts')){
global $submenu;
unset($submenu['upload.php'][5]); // hide the Media Library
}
}
add_action('admin_menu', 'wpse85351_hide_submenus');
If you want to change/remove the Media strings:
you can use the media_view_strings
filter:
function wpse85351_media_strings($strings) {
// only for subscribers:
if(!current_user_can('edit_posts')){
// remove "mediaLibraryTitle"
unset($strings["mediaLibraryTitle"]);
}
return $strings;
}
add_filter('media_view_strings','wpse85351_media_strings');
You can use
!current_user_can('edit_posts')
instead of
!current_user_can( 'administrator' ) || !current_user_can( 'editor' ) || !current_user_can( 'contibutor' ) || !current_user_can( 'author' )
to restrict it only to “subscribers”.
Here is the array of all the Media View Strings that you can unset or change to your needs:
Array
(
[url] => URL
[addMedia] => Add Media
[search] => Search
[select] => Select
[cancel] => Cancel
[selected] => %d selected
[dragInfo] => Drag and drop to reorder images.
[uploadFilesTitle] => Upload Files
[uploadImagesTitle] => Upload Images
[mediaLibraryTitle] => Media Library
[insertMediaTitle] => Insert Media
[createNewGallery] => Create a new gallery
[returnToLibrary] => ← Return to library
[allMediaItems] => All media items
[noItemsFound] => No items found.
[insertIntoPost] => Insert into post
[uploadedToThisPost] => Uploaded to this post
[warnDelete] => You are about to permanently delete this item.
'Cancel' to stop, 'OK' to delete.
[insertFromUrlTitle] => Insert from URL
[setFeaturedImageTitle] => Set Featured Image
[setFeaturedImage] => Set featured image
[createGalleryTitle] => Create Gallery
[editGalleryTitle] => Edit Gallery
[cancelGalleryTitle] => ← Cancel Gallery
[insertGallery] => Insert gallery
[updateGallery] => Update gallery
[addToGallery] => Add to gallery
[addToGalleryTitle] => Add to Gallery
[reverseOrder] => Reverse order
)