In this post, we’ll be discussing how to disable the use of Google Fonts in Elementor using a simple code snippet. This can be useful for those who want to improve page load time, or who want to use self-hosted fonts instead.
The code snippet uses the elementor/frontend/print_google_fonts
filter and the __return_false
function to prevent Elementor from loading Google Fonts.
The __return_false
function returns false and it is used as a callback function for the filter elementor/frontend/print_google_fonts
, which is responsible for printing Google Fonts on the frontend. By returning false, it prevents Elementor from loading Google Fonts on your website.
It’s worth noting that Elementor uses Google fonts by default, and this code snippet will disable all of them. If you want to use specific Google fonts, you can use Elementor’s built-in font options or use a plugin that allows you to use Google fonts without the need to load them from the Google servers.
Summary:
By adding this code snippet to your functions.php file, you can easily disable the use of Google Fonts in Elementor. This can be useful for those who want to improve page load time, or who want to use self-hosted fonts instead. Remember to test it before going live and make sure you have the proper backup of your website.