How to Host Local Fonts in WordPress?

Adding custom fonts to your website improves user experience and typography of the website, but it also slows down website loading speed. To avoid this you can host the fonts locally.

First of all, you need to download the fonts in web format. There are multiple websites where you can do this. If you have the font in a different format, you can convert it to web.

To store your custom fonts on your hosting server you need to upload them there via FTP or cPanel File Manager. Create a new Fonts folder in your WordPress theme directory and then upload the fonts to this folder.

After this it’s necessary to load the fonts in the stylesheet of the theme, use custom CSS for this. For example:

1 @font-face {
2 font-family: Arvo;
3 src: url(https://example.com/wp-content/themes/twentytwentythree/fonts/Arvo-Regular.ttf);
4 font-weight: normal;
5 }

You need to replace the font family and URL with your data.

Add the code to your theme’s style.css file or use the Additional CSS section of the theme customizer and use your custom font anywhere you need.

Was this article helpful?