Disable and Remove Google Fonts - Version 1.4.3

Version Description

Download this release

Release Info

Developer DannyCooper
Plugin Icon wp plugin Disable and Remove Google Fonts
Version 1.4.3
Comparing to
See all releases

Code changes from version 1.4.2 to 1.4.3

Files changed (3) hide show
  1. changelog.txt +4 -0
  2. disable-remove-google-fonts.php +30 -1
  3. readme.txt +1 -0
changelog.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  = 1.4.2 =
2
 
3
  * Remove the preconnect hint to fonts.gstatic.com in the Divi theme.
1
+ = 1.4.3 =
2
+
3
+ * Add compatibility for Avada.
4
+
5
  = 1.4.2 =
6
 
7
  * Remove the preconnect hint to fonts.gstatic.com in the Divi theme.
disable-remove-google-fonts.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Optimize frontend performance by disabling Google Fonts. GDPR-friendly.
6
  * Author: Fonts Plugin
7
  * Author URI: https://fontsplugin.com
8
- * Version: 1.4.2
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
11
  *
@@ -160,3 +160,32 @@ add_action( 'init', 'drgf_remove_divi_preconnect' );
160
  function drgf_remove_divi_preconnect() {
161
  remove_action( 'wp_enqueue_scripts', 'et_builder_preconnect_google_fonts', 9 );
162
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  * Description: Optimize frontend performance by disabling Google Fonts. GDPR-friendly.
6
  * Author: Fonts Plugin
7
  * Author URI: https://fontsplugin.com
8
+ * Version: 1.4.3
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
11
  *
160
  function drgf_remove_divi_preconnect() {
161
  remove_action( 'wp_enqueue_scripts', 'et_builder_preconnect_google_fonts', 9 );
162
  }
163
+
164
+ /**
165
+ * Dequeue Google Fonts loaded by Avada theme.
166
+ */
167
+ $fusion_options = get_option( 'fusion_options', false );
168
+ if (
169
+ $fusion_options
170
+ && isset( $fusion_options['gfonts_load_method'] )
171
+ && $fusion_options['gfonts_load_method'] === 'cdn'
172
+ ) {
173
+ add_filter(
174
+ 'fusion_google_fonts',
175
+ function( $fonts ) {
176
+ return array();
177
+ },
178
+ 99999
179
+ );
180
+ }
181
+
182
+ /**
183
+ * Avada caches the CSS output so we need to clear the
184
+ * cache once the fonts have been removed.
185
+ */
186
+ function dgrf_flush_avada_cache() {
187
+ if ( function_exists( 'fusion_reset_all_caches' ) ) {
188
+ fusion_reset_all_caches();
189
+ }
190
+ }
191
+ register_activation_hook( __FILE__, 'dgrf_flush_avada_cache' );
readme.txt CHANGED
@@ -23,6 +23,7 @@ This plugin will work with all WordPress themes and has been specifically tested
23
  * Twenty Seventeen
24
  * Twenty Nineteen
25
  * Twenty Twenty
 
26
  * Enfold
27
  * Sydney
28
  * Hestia
23
  * Twenty Seventeen
24
  * Twenty Nineteen
25
  * Twenty Twenty
26
+ * Avada
27
  * Enfold
28
  * Sydney
29
  * Hestia