Disable and Remove Google Fonts - Version 1.3.3

Version Description

  • Add compatibility for Anders Noren's (@anlino) themes.
Download this release

Release Info

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

Code changes from version 1.3.2 to 1.3.3

Files changed (2) hide show
  1. disable-remove-google-fonts.php +17 -4
  2. readme.txt +7 -3
disable-remove-google-fonts.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Plugin Name: Disable/Remove Google Fonts
4
  * Plugin URI: https://wordpress.org/plugins/disable-remove-google-fonts/
5
- * Description: Optimize frontend performance by disabling Google Fonts.
6
  * Author: Fonts Plugin
7
  * Author URI: https://fontsplugin.com
8
- * Version: 1.3.2
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
11
  *
@@ -32,12 +32,25 @@ function drgf_dequeueu_fonts() {
32
  [ 'olympus-google-fonts' ]
33
  );
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  foreach ( $wp_styles->registered as $style ) {
36
  $handle = $style->handle;
37
  $src = $style->src;
38
- $gfonts = strpos( $src, 'fonts.googleapis' );
39
 
40
- if ( false !== $gfonts ) {
41
  if ( ! array_key_exists( $handle, array_flip( $allowed ) ) ) {
42
  wp_dequeue_style( $handle );
43
  }
2
  /**
3
  * Plugin Name: Disable/Remove Google Fonts
4
  * Plugin URI: https://wordpress.org/plugins/disable-remove-google-fonts/
5
+ * Description: Optimize frontend performance by disabling Google Fonts. GDPR-friendly.
6
  * Author: Fonts Plugin
7
  * Author URI: https://fontsplugin.com
8
+ * Version: 1.3.3
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
11
  *
32
  [ 'olympus-google-fonts' ]
33
  );
34
 
35
+ /**
36
+ * Some themes set the Google Fonts URL as a dependency, so we need to replace
37
+ * it with a blank value rather than removing it entirely. As that would
38
+ * remove the stylesheet too.
39
+ */
40
+ foreach ( $wp_styles->registered as $style ) {
41
+ foreach( $style->deps as $dep ) {
42
+ if ( ( strpos( $dep, 'google-fonts' ) !== false ) || ( strpos( $dep, 'google_fonts' ) !== false ) || ( strpos( $dep, 'googlefonts' ) !== false ) ) {
43
+ $wp_styles->remove( $dep );
44
+ $wp_styles->add( $dep, '' );
45
+ }
46
+ }
47
+ }
48
+
49
  foreach ( $wp_styles->registered as $style ) {
50
  $handle = $style->handle;
51
  $src = $style->src;
 
52
 
53
+ if ( strpos( $src, 'fonts.googleapis' !== false ) ) {
54
  if ( ! array_key_exists( $handle, array_flip( $allowed ) ) ) {
55
  wp_dequeue_style( $handle );
56
  }
readme.txt CHANGED
@@ -1,12 +1,12 @@
1
  === Disable and Remove Google Fonts ===
2
- Contributors: DannyCooper, googlefonts
3
  Tags: google, gdpr, dsgvo, google fonts, disable google fonts, optimize, optimization, speed
4
  Requires at least: 4.8
5
- Tested up to: 5.8
6
  License: GPLv2 or later
7
  Stable tag: trunk
8
 
9
- Improve frontend performance by disabling Google Fonts.
10
 
11
  == Description ==
12
  Improve frontend performance by disabling [Google Fonts](https://wordpress.org/plugins/olympus-google-fonts/) loaded by themes and plugins.
@@ -67,6 +67,10 @@ We are 99.99% certain it will, if it doesn't then please create a [support ticke
67
 
68
  == Changelog ==
69
 
 
 
 
 
70
  = 1.3.2 =
71
 
72
  * Remove fonts added by the Divi Extra theme.
1
  === Disable and Remove Google Fonts ===
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: 5.9
6
  License: GPLv2 or later
7
  Stable tag: trunk
8
 
9
+ Improve frontend performance by disabling Google Fonts. GDPR-friendly.
10
 
11
  == Description ==
12
  Improve frontend performance by disabling [Google Fonts](https://wordpress.org/plugins/olympus-google-fonts/) loaded by themes and plugins.
67
 
68
  == Changelog ==
69
 
70
+ = 1.3.3 =
71
+
72
+ * Add compatibility for Anders Noren's (@anlino) themes.
73
+
74
  = 1.3.2 =
75
 
76
  * Remove fonts added by the Divi Extra theme.