You will need a True Type Font format (TTF) and a Web Open Font format (WOFF). However, Google Fonts only gives you the TFF. You will need a file converter, so you can convert that TTF to WOFF. Convertio has a free font converter tool so you can generate a WOFF file.
5. Upload to your site
Once you have the TTF and WOFF files, you will need to upload them using FTP. It’s best to go to your theme’s folder or, even better, a child theme, and create a subfolder. Your theme will be located in the themes’ folder within your wp-content directory. Name that subfolder “fonts”, and then upload your WOFF file into it.
6. Add code to your theme’s CSS (Style sheet)
This step is a two-parter. First, you have to add the @font-face code to tell your stylesheet where to find the fonts that you uploaded. The second part is changing the font family to coordinate with the font you want to use. The @font-face CSS method is a way for you to specify a custom font on your website.
Part 1 - Add @font-face code to tell your stylesheet where to find your font.
Add the following code to your theme’s style.css, or a custom stylesheet:
@font-face {
font-family: 'Roboto-Regular';
src: url('https://yoururl/fonts/Roboto-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
}
Replace yoururl with the path of where your font is. That will most likely be something like yourdomain/wp-content-/yourthemenamehere/fonts/Roboto-Regular.woff.
Part 2 - Replace other areas of your stylesheet (style.css) with the new font that you want to use.
Once you’ve added the @font-face method that tells your stylesheet where you’ve saved your custom font, you will need to specify what font elements you wish to style. For example, if you wanted to change you H1 Title heading tag to Roboto Regular, you would add the following code:
h1 {
font-family: 'Roboto-Regular';
}
If you have an existing theme, you can just replace the listed font family with ‘Roboto-Regular’, as an example.
How to Stop Google Fonts from Loading
This part might seem a bit confusing, but this is different from hosting locally. This section is about disabling the embedded Google fonts so you can just use the Google fonts locally in WordPress.
This is a bit more involved, but if you’re not code savvy, you can try a plugin like Disable and Remove Google fonts. There is a possibility that this may not work with all themes.
In the case that the plugin doesn’t work, sometimes your theme’s functions.php file may have some lines of code like the following: