Adding Google Fonts Without Plugin is one of the easiest ways to keep your WordPress site fast and lightweight. In this quick dev tip, you’ll learn how to do it manually in a few steps.
Step 1: Get Your Google Fonts Link
Visit Google Fonts, choose your font, select the weights you need, and copy the <link> tag.
Step 2: Add the Link to functions.php
Use this snippet in your functions.php or QuickDevTips child theme:
function qdt_add_google_fonts() {
wp_enqueue_style( ‘qdt-google-fonts’, ‘https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap’, false );
}
add_action( ‘wp_enqueue_scripts’, ‘qdt_add_google_fonts’ );
Step 3: Use the Font in Your CSS
Add the font-family rule to your custom CSS:
body {
font-family: ‘Roboto’, sans-serif;
}
Why This Matters
Using Google Fonts Without Plugin helps you avoid extra bloat and keep your WordPress site lean and fast-loading.
Common Mistake
Don’t forget to clear your cache or CDN after adding custom fonts. This ensures you see the new fonts instantly.
Pro Tip
If you have a child theme, add this in your child theme’s functions.php to prevent it from being overwritten by theme updates.
Related Snippet
If you found this helpful, check out my guide on adding custom JS Without Plugin in WordPress.