Elementor禁用Google字体

June, 24th 2022 1 min read

在function.php中插入如下代码即可:

plaintext
1
      add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );
    

另外,由于WordPress后台加载的时候,elementor默认也用了Google font (roboto),同样需要禁用它,不然一样非常慢。

附elementor官方说明:

Google Font Loading Method Options

Go to Elementor > Settings > Advanced tab and change the Google Fonts Load to one of the options. From the dropdown menu, select from the following loading options:

  • Default – The font display strategy is defined by the browser.
  • Blocking – Hides the text until the font has fully loaded.
  • Swap – Use a fallback-font to display, until the font has fully loaded.
  • Fallback – Hides the text for a minimal period and will use the font only if loaded within a few seconds.
  • Optional – Hides the text for a minimal period and will use the fallback-font unless the font is already fully loaded.