Support » Plugins » Custom Icons in Media Manager for Custom Mime Types

  • Hello WordPress friends!

    I’ve created a custom mime type through functions.php using this code:

    function custom_upload_mimes ( $existing_mimes=array() ) {
    $existing_mimes['vcf'] = 'application/vcard';
    return $existing_mimes;
    add_filter('upload_mimes', 'custom_upload_mimes');
    function modify_post_mime_types($post_mime_types) {
    	$post_mime_types['application/vcard'] = array(__('Contact Card', 'vcf'), __('Manage Contact Card', 'vcf'), __ngettext_noop('Contact Card (%s)', 'Contact Cards (%s)', 'vcf'));
    	return $post_mime_types;
    add_filter('post_mime_types', 'modify_post_mime_types');

    I can upload this type of file successfully, and there is a custom section for it in the media manager.

    Problem: media manager shows a grey default icon (wp-includes/images/crystal/default.png) for my new files. I would like to use an icon that is indicative of the file type. It seems that this was possible in past versions of WordPress, but I can’t find a way to accomplish it now.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I wonder if your found a fix for this? I’m trying to do exactly the same thing!


    You know, I never did find a solution and just left it at the default for that project; however, I just did a quick search and found this blog post that might have a solution for you (about 1/2 way down).

    Good luck!

    Hi, thanks for getting back to me. It’s a novelty for me to actually get a reply on here, so I’m very grateful. Dunno what I’m doing wrong, but nobody ever seems to reply to my posts here…

    Anyway, that looks like it’ll do what I want. Maybe I also need to incorporate a method for checking if new icons have been installed following a WordPress update, and if so, copy the new ones to the replacement icon directory, so that the old icons won’t get ‘stuck’. Hmm.

    Thanks again,


    Works a treat, thanks!


    Great!! Thanks for posting your result! Now, if I can just remember this solution next time the problem pops up for me…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Icons in Media Manager for Custom Mime Types’ is closed to new replies.