【问题标题】:How to prevent local plugins from loading on Wordpress?如何防止本地插件在 Wordpress 上加载?
【发布时间】:2021-02-04 20:21:06
【问题描述】:

我最近在移动设备上测试了我的网站,发现loading times 很糟糕。我发现这些字体正在加载,但并未在网站本身上使用:

wp-content/plugins/boostify-header-footer-builder/assets/fonts/ionicons.ttf
wp-content/plugins/elementskit-lite/modules/controls/assets/fonts/elementskit.woff?y24e1e

除了谷歌:

https://fonts.gstatic.com/s/roboto/v20/KFOmCnqEu92Fr1Mu4mxK.woff2
https://fonts.gstatic.com/s/roboto/v20/KFOlCnqEu92Fr1MmWUlfBBc4.woff2

我不使用其中任何一个,它们占用了将近 0.5 mb。如何防止它们加载?

【问题讨论】:

    标签: php wordpress plugins wordpress-theming


    【解决方案1】:

    这似乎行得通。

    function remove_fonts_stylesheet() {  
        wp_dequeue_style( 'google-fonts-roboto' );
        wp_dequeue_style( 'elementskit' );
        wp_dequeue_style( 'litespeedfont' );
    }
    add_action( 'wp_enqueue_scripts', 'remove_fonts_stylesheet', 999 );
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-08
      • 1970-01-01
      • 2015-02-02
      • 2019-09-23
      • 2012-06-02
      • 2023-03-24
      • 1970-01-01
      • 2012-02-26
      相关资源
      最近更新 更多