Disable and Remove Google Fonts - Version 1.4.5

Version Description

Download this release

Release Info

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

Code changes from version 1.4.4 to 1.4.5

Files changed (3) hide show
  1. changelog.txt +4 -0
  2. disable-remove-google-fonts.php +31 -1
  3. readme.txt +2 -1
changelog.txt CHANGED
@@ -1,5 +1,9 @@
1
  = 1.4.4 =
2
 
 
 
 
 
3
  * Add compatibility for Vantage.
4
 
5
  = 1.4.3 =
1
  = 1.4.4 =
2
 
3
+ * Add compatibility for WPBakery.
4
+
5
+ = 1.4.4 =
6
+
7
  * Add compatibility for Vantage.
8
 
9
  = 1.4.3 =
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.4
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
11
  *
@@ -76,6 +76,7 @@ function drgf_dequeueu_fonts() {
76
 
77
 
78
  }
 
79
  add_action( 'wp_enqueue_scripts', 'drgf_dequeueu_fonts', PHP_INT_MAX );
80
  add_action( 'wp_print_styles', 'drgf_dequeueu_fonts', PHP_INT_MAX );
81
 
@@ -195,3 +196,32 @@ function dgrf_flush_avada_cache() {
195
  }
196
  }
197
  register_activation_hook( __FILE__, 'dgrf_flush_avada_cache' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.5
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
11
  *
76
 
77
 
78
  }
79
+
80
  add_action( 'wp_enqueue_scripts', 'drgf_dequeueu_fonts', PHP_INT_MAX );
81
  add_action( 'wp_print_styles', 'drgf_dequeueu_fonts', PHP_INT_MAX );
82
 
196
  }
197
  }
198
  register_activation_hook( __FILE__, 'dgrf_flush_avada_cache' );
199
+
200
+ /**
201
+ * WPBakery enqueues fonts correctly using wp_enqueue_style
202
+ * but does it late so this is required.
203
+ */
204
+ function dgrf_dequeue_wpbakery_fonts() {
205
+ global $wp_styles;
206
+
207
+ if ( ! ( $wp_styles instanceof WP_Styles ) ) {
208
+ return;
209
+ }
210
+
211
+ $allowed = apply_filters(
212
+ 'drgf_exceptions',
213
+ [ 'olympus-google-fonts' ]
214
+ );
215
+
216
+ foreach ( $wp_styles->registered as $style ) {
217
+ $handle = $style->handle;
218
+ $src = $style->src;
219
+
220
+ if ( strpos( $src, 'fonts.googleapis' ) !== false ) {
221
+ if ( ! array_key_exists( $handle, array_flip( $allowed ) ) ) {
222
+ wp_dequeue_style( $handle );
223
+ }
224
+ }
225
+ }
226
+ }
227
+ add_action( 'wp_footer', 'dgrf_dequeue_wpbakery_fonts' );
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: DannyCooper
3
  Tags: google, gdpr, dsgvo, google fonts, disable google fonts, optimize, optimization, speed
4
  Requires at least: 4.8
5
- Tested up to: 6.0
6
  License: GPLv2 or later
7
  Stable tag: trunk
8
 
@@ -44,6 +44,7 @@ It will also remove Google Fonts loaded by the following plugins:
44
  * Elementor
45
  * Beaver Builder
46
  * Revolution Slider
 
47
 
48
  As well as improving page load speed, removing Google Font references can also aid with GDPR and DSGVO compliance.
49
 
2
  Contributors: DannyCooper
3
  Tags: google, gdpr, dsgvo, google fonts, disable google fonts, optimize, optimization, speed
4
  Requires at least: 4.8
5
+ Tested up to: 6.1
6
  License: GPLv2 or later
7
  Stable tag: trunk
8
 
44
  * Elementor
45
  * Beaver Builder
46
  * Revolution Slider
47
+ * WPBakery (Visual Composer)
48
 
49
  As well as improving page load speed, removing Google Font references can also aid with GDPR and DSGVO compliance.
50