HTTPS thumbnail

Resolved! Loading Your Google Fonts Over https (SSL) Sites

I couldn’t believe how simple it was! I spent days and nights searching for how to make my Google Fonts load properly on my WordPress https (SSL) site.

Here’s the basic story. I run an e-commerce store with an SSL certificate installed on the domain. I created the logo with the “La Belle Aurore” font from Google. When customers pay for their purchase, they land on the cart page over https. My logo wasn’t showing properly in Internet Explorer 11 or in Safari on iPhones, so I really had to resolve this issue.

I’d seen people try to fix it with odd code in the .htaccess file or by tweaking the functions.php file of the WordPress theme. I tried those, but none of them worked for me.

Ta-dah! It was simpler than I thought. My CSS requested the font over http://, and browsers block insecure (mixed) content on https pages. The fix is to load the font over https://. So DO use “https://fonts.googleapis.com/…”, NOT “http://fonts.googleapis.com/…”. (Back then I simply deleted the http: part to make a protocol-relative // URL, but today every site should run on https, so write https:// explicitly.)

@import url('https://fonts.googleapis.com/css2?family=NAME+OF+YOUR+FONT&display=swap');

I used the “La Belle Aurore” font on my site, so here’s what I have:

@import url('https://fonts.googleapis.com/css2?family=La+Belle+Aurore&display=swap');

Even better, load the font with a <link> tag in your HTML <head> instead of @import, so the browser can start downloading it sooner:

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=La+Belle+Aurore&display=swap" rel="stylesheet">

I hope this method saves you time as well. Good luck!

Leave a Comment

Your email address will not be published. Required fields are marked *