gpt4 book ai didi

css - Genesis 框架中的 wp_dequeue_style 不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 10:01:40 24 4
gpt4 key购买 nike

我希望从我的子 genesis 主题中的重复 css 中清除我的代码。一些插件使用相同的库但版本不同,例如 font-awesome。

如果你在这里看到 html 代码 www.cartomanziadivinazione.it 你可以看到:

<link rel='stylesheet' id='fontawesome-css' href='//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css?ver=1.3.9' type='text/css' media='all' />

我想删除这一行,我在函数主题中写了这个

add_action('wp_enqueue_scripts', 'cleaning_seo');

function cleaning_seo() {
wp_dequeue_style( 'fontawesome-css' );
wp_deregister_style( 'fontawesome-css' );
}

但是没有...

最佳答案

根据 codex :

Remove an enqueued script.

To be dequeued, the script must have been enqueued. Attempting to dequeue a script before the script is enqueued will have no effect.

因此,有可能您正试图在脚本排队之前将其从队列中取出。

确保您在正确的地方使用此功能;尝试增加执行顺序:

add_action('wp_enqueue_scripts', 'cleaning_seo', 999);

关于css - Genesis 框架中的 wp_dequeue_style 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38294437/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com