admin管理员组

文章数量:1392003

During the new GDPR (DSGVO in Germany). We have to remove all the google fonts (if loaded from google).

To do so I searched a little in the SC of Divi.

For all of you who need a quick fix.

Here is something for you're functions.php(child theme please)

// REMOVE ALL DIVI GOOGLE FONTS FROM DIVI
function et_builder_get_google_fonts() {return array();}
function et_get_google_fonts() {return array();}
function disable_gfonts_divi() {
wp_dequeue_style( 'divi-fonts' );
wp_dequeue_style('et-builder-googlefonts');
wp_dequeue_style('et-builder-googlefonts-cached');
}

add_action( 'wp_enqueue_scripts', 'disable_gfonts_divi', 20 );
// END GOOGLE FONTS REMOVE

During the new GDPR (DSGVO in Germany). We have to remove all the google fonts (if loaded from google).

To do so I searched a little in the SC of Divi.

For all of you who need a quick fix.

Here is something for you're functions.php(child theme please)

// REMOVE ALL DIVI GOOGLE FONTS FROM DIVI
function et_builder_get_google_fonts() {return array();}
function et_get_google_fonts() {return array();}
function disable_gfonts_divi() {
wp_dequeue_style( 'divi-fonts' );
wp_dequeue_style('et-builder-googlefonts');
wp_dequeue_style('et-builder-googlefonts-cached');
}

add_action( 'wp_enqueue_scripts', 'disable_gfonts_divi', 20 );
// END GOOGLE FONTS REMOVE

If one of you has some to add or if it could be done a little nicer please tell me.

Share Improve this question edited Jun 4, 2018 at 8:52 Partha 4024 silver badges15 bronze badges asked Jun 4, 2018 at 8:21 Axel LodygaAxel Lodyga 111 silver badge3 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

In recent Divi update, this theme es with an option to enable or disable the google font.

You can get that option in Divi > theme option > general settings. Please go to Divi > theme option > General settings > Use Google font > Disable the option > save and check

An alternative to disabling Google Fonts is, to embed those fonts in your WordPress website.

I've created a plugin for that, which solves that GDPR requirement and integrates smoothly with Divi. All you need to do is:

  1. Install the plugin GDPR Cache Scripts & Styles
  2. Activate the plugin
  3. Wait 4-5 minutes for the plugin to download all fonts

Full plugin link: https://wordpress/plugins/gdpr-cache-scripts-styles/

本文标签: javascriptHow to remove all google fonts in diviStack Overflow