Remove / Disable Google Font WordPress
I'm using the getwid block in WordPress to extend the Gutenberg editor. this brings with it google fonts, which then establish a connection to google. this can lead to privacy issues and that's why i want to include the local fonts and disconnect from the online google api.
I've tried different ways to disconnect from Google and mount locally. Unfortunately I haven't made it yet. 1. - 4. are inserted via the functions.php. 5. are inserted above the footer.php I read that Getwid has built-in filters to disable Google Fonts. So I tried again some javascript code to disconnect.
1. attempt Filter to separate the google fonts elementor
add_filter('elementor/frontend/print_google_fonts', '__return_false');
I tried that with getwid
add_filter('getwid/frontend/print_google_fonts', '__return_false' );
2. attempt Disconnect Google Fonts via mime types
add_filter('upload_mimes', 'add_custom_upload_mimes');
function add_custom_upload_mimes($existing_mimes) {
$existing_mimes['otf'] = 'application/x-font-otf';
$existing_mimes['woff'] = 'application/x-font-woff';
$existing_mimes['woff2'] = 'application/x-font-woff';
$existing_mimes['ttf'] = 'application/x-font-ttf';
$existing_mimes['svg'] = 'image/svg+xml';
$existing_mimes['eot'] = 'application/vnd.ms-fontobject';
return $existing_mimes;
}
3. attempt Completely removes all calls to the API
add_filter('blocksy:typography:google:use-remote', function () {
return false;
});
add_filter('blocksy_typography_font_sources', function ($sources) {
unset($sources['google']);
return $sources;
});
4. attempt Remove individual fonts
function remove_google_fonts_stylesheet() {
wp_dequeue_style( 'google-fonts-opensans' );
}
add_action( 'wp_enqueue_scripts', 'remove_google_fonts_stylesheet', 999 );
5. attempt Disable Google Web Fonts with JavaScript
document.addEventListener('om.Scripts.init', function(event) {
event.detail.Scripts.enabled.fonts = false;

