Skip to content

Commit

Permalink
Jetpack Google Fonts: Add filter to conditionally skip loading (#36980)
Browse files Browse the repository at this point in the history
* Jetpack Google Fonts: Add filter to conditionally skip loading

* changelog

* Update projects/plugins/jetpack/modules/google-fonts/load.php

---------

Co-authored-by: Jeremy Herve <[email protected]>
  • Loading branch information
mreishus and jeherve authored Apr 19, 2024
1 parent a03b066 commit 9df9b80
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/update-google-fonts-skip
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Jetpack Google Fonts: Add filter to conditionally skip loading
17 changes: 17 additions & 0 deletions projects/plugins/jetpack/modules/google-fonts/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 9df9b80

Please sign in to comment.