Archived topic
Local Font Upload ttf file denied
15 replies · Started by Melanie Swan on February 21, 2020
Hello,
I was following the tutorial how to host fonts on GP locally. Unfortunately the ttf file was not allowed due to security reasons. All other files I could upload. Is there something new in WP?
I am on PHP 7.4. Newest GP, Newest WP
Thanks.
Hi there,
Are you using any security plugins?
If not then I'd recommend checking with your hosting support.
Thanks
No problem :)
I have the same problem. Called to my hosting and they are not blocking that file. I installed wordpress in local and its also not working. ttf file denied.
I had to temporarily add the following code to wp-config.php:
define('ALLOW_UNFILTERED_UPLOADS', true);
And then of course deleted it as soon as I had uploaded the font.
Hi there,
glad to hear you found a solution to the issue.
As a general note - if you have .woff and .woff2 variants of the font then .ttf isn't really required.
I´m having the same problem. Is there a way to add that code define('ALLOW_UNFILTERED_UPLOADS', true); with a snippet?
Hi there,
that code needs to go in the wp-config theres no snippet alternative for that.
Is it only the ttf file you're having an issue with ?
Hi David,
I´m sorry for the late reply, I was not home. It won´t allow me to upload the tff, woff and woff2 files, either using the media uploader nor through ftp connection. I can only upload the html and eot files from the unzipped folder. My hosting provider shouldn´t be the issue as they themselves have a couple of blog posts where they recommend their clients to self-host google fonts.
Hi Oliver,
Are you not able to access the wp-config through FTP? If not, can you reach out to your Hosting Provider for assistance with regards to accessing that file?
Hi Fernando, I didn´t know I should look for a config.php file and edit it, I thought that was something that could be done in the theme file editor.
Just to be sure, I connect via ftp, search for config.php, download a copy and add the code define('ALLOW_UNFILTERED_UPLOADS', true);, with notepad, upload the edited file after removing the original, upload the fonts, and edit the config.php to remove define('ALLOW_UNFILTERED_UPLOADS', true); and replace the newly edited file after deleting the file with the code.
Yes, that's correct. You may learn more about the process here: https://kinsta.com/knowledgebase/sorry-this-file-type-is-not-permitted-for-security-reasons/#how
You may also try Rotyslav's suggestion if you don't want to do it that way.
Thanks a lot both of you guys, have a nice day.