Add a vCard to Your WordPress Site

January 21, 2014 / Updated: December 5, 2019 / Lena Shore

vc-ardAdding a vCard to your WordPress site may seem like an easy task. Unfortunately, when you try to add it as media, it is all too easy to get an error similar to: “Error saving media attachment.”

This is typically because WordPress doesn’t support that file type by default. “But WHY?” you might scream. “It’s a security feature!” a tight-fisted WordPress might answer. The makers of WordPress know not to give access to things you don’t need to – lest you open yourself up for hackers.

However, there may come a day where you need to add this functionality to your site. Happily, adding it is easy. Just pop this code into your functions file. After that you should be able to upload vCards through the Media area.

add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() ){
// add your extension to the array
$existing_mimes['vcf'] = 'text/x-vcard'; return $existing_mimes;

NOTE: Your functions.php file is inside your theme folder on your server (wp-content –> themes –> yourtheme). However, you can often access it through Appearance –> Theme Editor from the admin area of your WordPress site.

Lena Shore

Lena is a full-time freelancer and nerd that specializes in web development, graphic design, and illustration. She enjoys building things, learning new things, pursuing creative endeavors, and giving free advice.


  1. Rachel D. Graham on September 1, 2015 at 11:52 pm

    I just added the above suggested code to my page and the entire page disappeared. Please help. Several days worth of work have been lost.

    • Lena Shore on September 2, 2015 at 6:59 am

      Rachel – I wouldn’t worry much about your code/work being gone. This can happen if you miss a character. Once that is corrected, I imagine your code will all come back.

      Depending upon how your functions file is laid out you may or may not need a closing php tag. Look at that first. You are welcome to send me your functions file (my contact form has an upload area) and I’ll take a look at it.


Leave a Comment

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.