Disable and Remove Google Fonts - Version 1.3.01

Version Description

Download this release

Release Info

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

Version 1.3.01

Files changed (2) hide show
  1. disable-remove-google-fonts.php +105 -0
  2. readme.txt +102 -0
disable-remove-google-fonts.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
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.0
9
+ * License: GPLv2 or later
10
+ * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
11
+ *
12
+ * @package disable-remove-google-fonts
13
+ */
14
+
15
+ // Exit if accessed directly.
16
+ if ( ! defined( 'ABSPATH' ) ) {
17
+ exit;
18
+ }
19
+
20
+ /**
21
+ * Dequeue Google Fonts based on URL.
22
+ */
23
+ function drgf_dequeueu_fonts() {
24
+ global $wp_styles;
25
+
26
+ if ( ! ( $wp_styles instanceof WP_Styles ) ) {
27
+ return;
28
+ }
29
+
30
+ $allowed = apply_filters(
31
+ 'drgf_exceptions',
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
+ }
44
+ }
45
+ }
46
+ // Dequeue Google Fonts loaded by Revolution Slider.
47
+ remove_action( 'wp_footer', array( 'RevSliderFront', 'load_google_fonts' ) );
48
+
49
+ // Dequeue the Jupiter theme font loader.
50
+ wp_dequeue_script( 'mk-webfontloader' );
51
+
52
+ }
53
+ add_action( 'wp_enqueue_scripts', 'drgf_dequeueu_fonts', 9999 );
54
+ add_action( 'wp_print_styles', 'drgf_dequeueu_fonts', 9999 );
55
+
56
+ /**
57
+ * Dequeue Google Fonts loaded by Elementor.
58
+ */
59
+ add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );
60
+
61
+ /**
62
+ * Dequeue Google Fonts loaded by Beaver Builder.
63
+ */
64
+ add_filter(
65
+ 'fl_builder_google_fonts_pre_enqueue',
66
+ function( $fonts ) {
67
+ return array();
68
+ }
69
+ );
70
+
71
+ /**
72
+ * Dequeue Google Fonts loaded by JupiterX theme.
73
+ */
74
+ add_filter(
75
+ 'jupiterx_register_fonts',
76
+ function( $fonts ) {
77
+ return array();
78
+ },
79
+ 99999
80
+ );
81
+
82
+ /**
83
+ * Dequeue Google Fonts loaded by the Hustle plugin.
84
+ */
85
+ add_filter( 'hustle_load_google_fonts', '__return_false' );
86
+
87
+ /**
88
+ * Dequeue Google Fonts loaded by the Hustle plugin.
89
+ */
90
+ add_filter( 'mailpoet_display_custom_fonts', '__return_false' );
91
+
92
+ /**
93
+ * Dequeue Google Fonts loaded by the Apollo13 Themes Framework.
94
+ */
95
+ if ( ! function_exists( 'apollo13framework_get_web_fonts_dynamic' ) ) {
96
+ function apollo13framework_get_web_fonts_dynamic() {
97
+ return;
98
+ }
99
+ }
100
+
101
+ if ( ! function_exists( 'apollo13framework_get_web_fonts_static' ) ) {
102
+ function apollo13framework_get_web_fonts_static() {
103
+ return;
104
+ }
105
+ }
readme.txt ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Disable and Remove Google Fonts ===
2
+ Contributors: DannyCooper, googlefonts
3
+ Tags: google, gdpr, dsgvo, google fonts, disable google fonts
4
+ Requires at least: 4.8
5
+ Tested up to: 5.6
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.
13
+
14
+ = Plugin Compatibility =
15
+
16
+ This plugin will work with all WordPress themes and has been specifically tested with the following:
17
+
18
+ * Twenty Twelve
19
+ * Twenty Thirteen
20
+ * Twenty Fourteen
21
+ * Twenty Fifteen
22
+ * Twenty Sixteen
23
+ * Twenty Seventeen
24
+ * Twenty Nineteen
25
+ * Twenty Twenty
26
+ * Sydney
27
+ * Storefront
28
+ * Hestia
29
+ * Zerif Lite
30
+ * Vantage
31
+ * ColorMag
32
+ * Shapely
33
+ * OnePress
34
+ * JupiterX
35
+
36
+ It will also remove Google Fonts loaded by the following plugins:
37
+
38
+ * MailPoet
39
+ * Elementor
40
+ * Beaver Builder
41
+ * Revolution Slider
42
+
43
+ As well as improving page load speed, removing Google Font references can also aid with GDPR and DSGVO compliance.
44
+
45
+ = Bugs =
46
+ If you find an issue with this plugin, please let us know [here](https://wordpress.org/support/plugin/disable-remove-google-fonts#new-post)!
47
+
48
+ = Contributions =
49
+ Anyone is welcome to contribute to this plugin.
50
+
51
+ There are various ways you can contribute:
52
+
53
+ 1. Raise an [Issue](https://wordpress.org/support/plugin/disable-remove-google-fonts#new-post)
54
+ 2. Translate the Disable and Remove Google Fonts plugin into [different languages](https://translate.wordpress.org/projects/wp-plugins/disable-remove-google-fonts/)
55
+ 3. Provide feedback and suggestions on [enhancements](https://wordpress.org/support/plugin/disable-remove-google-fonts#new-post)
56
+
57
+ == Installation ==
58
+ Upload 'Disable and Remove Google Fonts', activate it, and you're done!
59
+
60
+ == Frequently Asked Questions ==
61
+
62
+ = Will my theme work with 'Disable and Remove Google Fonts'? =
63
+
64
+ We are 99.99% certain it will, if it doesn't then please create a [support ticket](https://wordpress.org/support/plugin/disable-remove-google-fonts#new-post).
65
+
66
+ == Changelog ==
67
+
68
+ = 1.3.0 =
69
+
70
+ * Remove fonts added by the Mailpoet plugin.
71
+
72
+ = 1.2.0 =
73
+
74
+ * Remove fonts added by the Apollo13 Theme Framework.
75
+
76
+ = 1.1.7 =
77
+
78
+ * Remove fonts added by the Hustle plugin.
79
+
80
+ = 1.1.6 =
81
+
82
+ * Remove fonts added by the original Jupiter theme.
83
+
84
+ = 1.1.5 =
85
+
86
+ * Remove fonts added by the JupiterX theme.
87
+
88
+ = 1.1.4 =
89
+
90
+ * Remove fonts added by the Beaver Builder plugin.
91
+
92
+ = 1.1.3 =
93
+
94
+ * Remove fonts added to wp_print_styles hook.
95
+
96
+ = 1.1.2 =
97
+
98
+ * Add Revolution Slider compatibility.
99
+
100
+ = 1.1.1 =
101
+
102
+ * Tested with WP5.3.