diff --git a/projects/plugins/jetpack/modules/google-fonts/current/class-jetpack-google-font-face.php b/projects/plugins/jetpack/modules/google-fonts/current/class-jetpack-google-font-face.php index f3a5948c2b533..55cf762aeefcb 100644 --- a/projects/plugins/jetpack/modules/google-fonts/current/class-jetpack-google-font-face.php +++ b/projects/plugins/jetpack/modules/google-fonts/current/class-jetpack-google-font-face.php @@ -23,13 +23,22 @@ class Jetpack_Google_Font_Face { */ public function __construct() { // Turns off hooks to print fonts + add_action( 'wp_loaded', array( $this, 'wp_loaded' ) ); add_action( 'current_screen', array( $this, 'current_screen' ), 10 ); // Collect and print fonts in use - add_action( 'wp_head', array( $this, 'print_font_faces' ), 10 ); + add_action( 'wp_head', array( $this, 'print_font_faces' ), 50 ); add_filter( 'pre_render_block', array( $this, 'collect_block_fonts' ), 10, 2 ); } + /** + * Turn off hooks to print fonts on frontend + */ + public function wp_loaded() { + remove_action( 'wp_head', 'wp_print_fonts', 50 ); + remove_action( 'wp_head', 'wp_print_font_faces', 50 ); + } + /** * Turn off hooks to print fonts on wp-admin, except for GB editor pages. */ @@ -45,8 +54,12 @@ public function current_screen() { * Print fonts that are used in global styles or block-level settings. */ public function print_font_faces() { - echo '
'; + print_r( $fonts ); + echo ''; + $font_slug_aliases = $this->get_font_slug_aliases(); $fonts_to_print = array();