You can do this with a three easy steps:
- Create a directory in your theme that will hold all the new icons /themes/theme-name/images/icons/
- Copy all the images from /wp-includes/images/crystal/ to your new directory
- Hook into the wp_mime_type_icon filter in your functions.php file
Your filter would look like this:
function change_mime_icon($icon, $mime = null, $post_id = null){
$icon = str_replace(get_bloginfo('wpurl').'/wp-includes/images/crystal/', WP_CONTENT_URL . '/themes/theme-name/images/icons/', $icon);
return $icon;
}
add_filter('wp_mime_type_icon', 'change_mime_icon');
To verify this is working, open the media library and browse the media gallery. If you see PHP warnings or errors, somethings has gone awry. If you see the icons displayed, you now have control over the images as they are being pulled from your theme directory.
Be careful not to change the names of the image files as they are called specifically in the core.
Related Posts:
- How use Videos from another directory?
- How do I select an image from Media Library in my plugin?
- Media Library plugins for better file management? [closed]
- How to add subfolders in media library for better organisation?
- How to display .ico files in the media library
- print_media_templates not applied in media manager plugin
- Uploading Images to Media Library via wp_handle_sideload() fails
- image_size_names_choose filter doesn’t show
- Add class=”media_type” when media is inserted into editor
- How do I ‘rebuild’ the WordPress Media library after transfer to new host?
- Proper way to hook wp_get_attachment_url or any other way to change that url in media library
- How can I list URLs of all audio files within my media gallery?
- Migrating to HTTPS only, most media library links need updating?
- Failing to open advanced-cache.php which is breaking Media Library
- Filter pictures in the media library [closed]
- Is there a way to delete images from the Media Library programatically?
- Add file name column to media library
- Is there a way to specify the tab to display when the Media Uploader is displayed?
- How to add ‘Attachment Display Settings’ in custom Media Library?
- Image width tag is less than the image pixel width – why?
- Register an additional image size for only some images in my media library
- WordPress 3.5 Media Manager – Reorder Selectbox items on Media Library Tab [duplicate]
- Inserting a Download Link in the Quick Edit Actions of the Media Library?
- Change default screen option value for media items per page (in media library)
- How do I control video media display sizing with native wordpress player
- Share media among different domains
- Where is the source of the media items filter
- how to download all media files into my computer
- Add image to media library from URL in uploads directory
- Function to get image from media library
- Adding Alt Attributes Automatically when Uploading Images to Media Library
- Media gallery thumbnails 1px
- How to have changes made in media library to be reflected on posts/pages
- Remove the ‘Attachment Details’ section of the wordpress media manager
- Why do I sometimes get an attachment id string instead of a url from an image’s guid field in the post table?
- How to change compression of WordPress uploads including original image
- Featured images get shrunken
- How to add a download link to a movie from WP media library?
- Pulling images from a subdomain
- Slow/Not Working Media Library Search
- wordpress not generate thumnails for mp4 videos
- Get image URL from media library “insert from url”
- Media Library not showing images properly
- Video uploaded with the native media uploader gives Error 404
- Media Content disapeared after upgrade WP core to 3.5.1
- Clean up wp-content/upload/ folder
- The best way to protect uploaded media in WordPress?
- Media Library Grid View Custom Filter
- how to remove thumbnail and LiteSpeed Optimization column in media library list-view?
- Not able to extend wp.media.view.AttachmentsBrowser
- Custom Media Modal and uploading
- Media Library No Longer Displays Images
- Media Library SSL
- WordPress does not detect all images in uploads folder?
- attachment media-template data model (data.size.url)
- Media library and posts list problems with WordPress on IIS
- Can I set multiple feature images to multiple posts from the media library?
- How do you alter the default WordPress thumbnail?
- “add from media library” tab is super slow [closed]
- Upload restrictions – upload_mimes – filter: Adding multiple MIMEs for a single extension and adding multiple extensions for a single MIME type?
- Reorder attachements in the media library
- Recalibrate _wp_attachment_metadata Image Dimensions
- Adding Alt Tag Column to Media Library List
- How to modify the attachment info text on gallery tab or media page?
- Adding Alt Tag and Dimensions columns to Media Library
- Extract url of every image in library?
- Media Library Latency, Lag, CRON?
- Is it Helpful to transfer all media library to another host? [closed]
- Is there a way to determine if the media-iframe is visible?
- What would be the URL to display the WordPress image editor with an image from the media library?
- Prevent other editors from viewing images of other editors in Add Media Popup
- Media attachment date and post date
- Is there a way to programmatically pass a category to the Media Library selector?
- User media folder for each users on registration
- Larger preview thumbnails in Media Library
- How can I no-index specific PDF files in my Avada WordPress media library so that they don’t appear in search results?
- Media Library http to https
- Filter media library by custom postmeta
- How do you find a file in the media library using the file URL?
- How to limit the amount of images uploaded to the media library within post.php
- Media library corrupted after upgrading to 4.9.6
- query that alternates text posts with images from media gallery
- Can multiple sites under one folder structure share media directories?
- WordPress Media Delete Logs
- WordPress not using edited image
- When I’m in post editor and click on ‘Add media’, why won’t it load the media library with this code?
- how to setup user access media library?
- Get filenames of available image sizes
- Use the “Media Library” in Frontend
- Why is my upload / Select media library button empty?
- WordPress Media Library
- All the Images in Media Library is showing broken links
- Broken image links in media library after restore
- Add Filename Colum to Media Library
- create a user’s owned folder on user registration
- 2 or more WordPress instances (Live vs Staging Test site) –> access 1 uploads.domain.com — images holder – see images in Media Library
- media library contains corrupt doubles
- How can I change the page title of PDFs opened from a WordPress link which use the browser’s viewer?
- Files showing in link but cannot be found in the upload directory
- Block non logged in users from accessing the media library