From 3d2ae25f4a543b67624762ddb643c072c9185b5c Mon Sep 17 00:00:00 2001 From: Matthew Reishus Date: Thu, 18 Apr 2024 14:45:13 -0500 Subject: [PATCH 1/3] Jetpack Google Fonts: Add filter to conditionally skip loading --- .../plugins/jetpack/modules/google-fonts/load.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/plugins/jetpack/modules/google-fonts/load.php b/projects/plugins/jetpack/modules/google-fonts/load.php index ca69f5a5cdde8..df33721342989 100644 --- a/projects/plugins/jetpack/modules/google-fonts/load.php +++ b/projects/plugins/jetpack/modules/google-fonts/load.php @@ -8,6 +8,21 @@ add_action( 'plugins_loaded', function () { + /** + * Filters whether to skip loading the Jetpack Google Fonts module. + * + * This filter allows skipping the loading of the Jetpack Google Fonts module + * based on specific conditions or requirements. By default, the module will + * load normally. If the filter returns true, the module will be skipped. + * + * @since $$next-version$$ + * + * @param bool $skip Whether to skip loading the Jetpack Google Fonts module. Default false. + */ + if ( apply_filters( 'jetpack_google_fonts_skip_load', false ) ) { + return; + } + if ( class_exists( 'WP_Font_Face' ) ) { // WordPress 6.5 or above with the new Font Library. require_once __DIR__ . '/current/load-google-fonts.php'; From 130b3226da1a05ca3aa895c1f1688dab4ef2ae94 Mon Sep 17 00:00:00 2001 From: Matthew Reishus Date: Thu, 18 Apr 2024 14:46:43 -0500 Subject: [PATCH 2/3] changelog --- projects/plugins/jetpack/changelog/update-google-fonts-skip | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 projects/plugins/jetpack/changelog/update-google-fonts-skip diff --git a/projects/plugins/jetpack/changelog/update-google-fonts-skip b/projects/plugins/jetpack/changelog/update-google-fonts-skip new file mode 100644 index 0000000000000..10248f6516b0d --- /dev/null +++ b/projects/plugins/jetpack/changelog/update-google-fonts-skip @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Jetpack Google Fonts: Add filter to conditionally skip loading From cb9d0ef125814491143551139917683c02818e32 Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Fri, 19 Apr 2024 09:43:56 +0200 Subject: [PATCH 3/3] Update projects/plugins/jetpack/modules/google-fonts/load.php --- projects/plugins/jetpack/modules/google-fonts/load.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/plugins/jetpack/modules/google-fonts/load.php b/projects/plugins/jetpack/modules/google-fonts/load.php index df33721342989..c4011d1998cbf 100644 --- a/projects/plugins/jetpack/modules/google-fonts/load.php +++ b/projects/plugins/jetpack/modules/google-fonts/load.php @@ -15,6 +15,8 @@ function () { * based on specific conditions or requirements. By default, the module will * load normally. If the filter returns true, the module will be skipped. * + * @module google-fonts + * * @since $$next-version$$ * * @param bool $skip Whether to skip loading the Jetpack Google Fonts module. Default false.