Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jetpack Google Fonts: Add filter to conditionally skip loading #36980

Merged
merged 3 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
15 changes: 15 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,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.
*
jeherve marked this conversation as resolved.
Show resolved Hide resolved
* @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
Loading