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 diff --git a/projects/plugins/jetpack/modules/google-fonts/load.php b/projects/plugins/jetpack/modules/google-fonts/load.php index ca69f5a5cdde8..c4011d1998cbf 100644 --- a/projects/plugins/jetpack/modules/google-fonts/load.php +++ b/projects/plugins/jetpack/modules/google-fonts/load.php @@ -8,6 +8,23 @@ 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. + * + * @module google-fonts + * + * @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';