Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I allow a single Wordpress site to accept my .ttf file upload?

I'm using the Font Organizer plugin for Wordpress. It has a nice option to upload a font, which I have saved to my computer. I just need to somehow get Wordpress to accept it so I can use it here:

enter image description here

However, I'm getting an error: Error uploading the file: Sorry, this file type is not permitted for security reasons.

How do I let Wordpress temporarily allow this? Also, is this method even going to work out? The end goal is for it to show up on the drop down list in the image above because I need to change the font of the header text. I can do any programming stuff needed.

like image 950
DarthVoid Avatar asked Jan 16 '17 00:01

DarthVoid


1 Answers

You can allow uploading the .ttf font on your site, by adding a simple filter code on function.php file.

Below is the code for .ttf font only

    add_filter('upload_mimes', 'add_custom_upload_mimes');
    function add_custom_upload_mimes($existing_mimes) {
        $existing_mimes['ttf'] = 'application/x-font-ttf';
        return $existing_mimes;
   }

You can add more MIME type in the function to allow to upload those file.

like image 86
Vishal Gupta Avatar answered Oct 02 '22 12:10

Vishal Gupta