简体   繁体   English

在WordPress中取消注册style.css

[英]Deregister style.css in WordPress

Does anyone know if it's possible to deregister the default stylesheet of a theme, style.css, in WordPress? 有谁知道是否可以在WordPress中注销主题的默认样式表style.css? I've tried going wp_deregister_style('style') and wp_deregister_style('style.css'), but neither seems to work. 我已经尝试过wp_deregister_style('style')和wp_deregister_style('style.css'),但似乎都不起作用。

I'm hoping to do this so I can optimise my site my combining my various stylesheets into one and minifying it with an Ant script. 我希望做到这一点,这样我就可以优化我的网站,将各种样式表合并为一个样式表,并使用Ant脚本将其缩小。

According to Wordpress behavior, which requires to pass a handle when registering and de-registering a stylesheet, and as the default stylesheet "style.css" is registered with the handle "screen", we should use this code : 根据Wordpress的行为,在注册和注销样式表时需要传递一个句柄,并且由于默认样式表“ style.css”已在句柄“ screen”中注册,因此我们应使用以下代码:

wp_dequeue_style('screen');
wp_deregister_style('screen');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM