Volg deze stappen om Google-lettertypen op uw WordPress-site uit te schakelen:
1. Log in op uw WordPress-dashboard.
2. Klik op Weergave -> Thema-editor .
3. In het rechterpaneel, klik op Themafuncties (functions.php) bestand.
4. Kopieer en plak de volgende code in het function.php-bestand:
```php
/*
* Schakel Google-lettertypen uit
*/
add_filter('wp_resource_hints', 'disable_google_fonts_resource_hints', 10, 2);
functie uitgeschakeld_google_fonts_resource_hints( $urls, $relation_type ) {
if (wp_style_is('google-fonts') ) {
$urls =remove_element_by_value( $urls, 'https://fonts.gstatic.com');
}
retourneer $urls;
}
/*
* Verwijder de Google Fonts-link uit het
*/
remove_action('wp_head', 'wp_resource_hints', 2);
/*
* Verwijder Google Fonts uit de WordPress Embed API
*/
add_filter('embed_oembed_html', 'disable_google_fonts_oembed_filter', 10, 4);
function uitgeschakeld_google_fonts_oembed_filter( $html, $post_id, $width, $height ) {
if (wp_style_is('google-fonts') ) {
$html =preg_replace( '/https:\/\/fonts.gstatic.com\/s\/.+?\/_.+?\//', '', $html);
}
retourneer $html;
}
/*
* Helperfunctie om een element uit een array te verwijderen
*/
functie remove_element_by_value($array, $value)
{
$index =array_search($waarde, $array);
als ($index !==false) {
niet ingesteld($array[$index]);
}
retourneer $array;
}
```
5. Klik op Bestand bijwerken om uw wijzigingen op te slaan.
Google Fonts wordt nu uitgeschakeld op uw WordPress-site. |