Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google font not loading in wordpress theme [duplicate]

I'm kinda new to WordPress custom theme building and I have a problem.

I have a google font Poppins and I have put the code in head.php:

<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=Poppins:wght@400;500;700&display=swap" rel="preload stylesheet" as="style">

when I open the network tab I see that they have indeed loaded:

see network tab here

I see the font being loaded on my computer but when I open it on some other device the font is not loaded. Some help will be much appreciated.

like image 758
Martin Avramov Avatar asked Dec 07 '25 02:12

Martin Avramov


1 Answers

Try

<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;700&display=swap" media="screen">

Also, if you have loaded the site/page previously on the other devices, make sure you clear cache.

like image 190
KingsInnerSoul Avatar answered Dec 08 '25 22:12

KingsInnerSoul