admin管理员组文章数量:1289423
I am currently using a Plugin, which has created a Stylesheet within the following directory: /wp-content/uploads/plugin-name/css
.
I would like to remove this Plugin's Stylesheet, since it is being called after my Custom Stylesheet, where the Plugin is performing unwanted overrides of the Custom Stylesheet.
Instead, I want to remove the Plugin's Stylesheet; copying only required styles into the Custom Stylesheet.
I tried placing the following into the functions.php
file, within the Child Theme:
<?php
function dequeue_dequeue_plugin_style(){
wp_dequeue_style( 'plugin-css' ); //Name of Style ID.
}
add_action( 'wp_enqueue_scripts', 'dequeue_dequeue_plugin_style', 999 );
?>
Unfortunately, this did not work. Is anyone able to see if I have gone wrong with my Code or whether Plugin Styles have priority over all files within a Child Theme etc.
I am currently using a Plugin, which has created a Stylesheet within the following directory: /wp-content/uploads/plugin-name/css
.
I would like to remove this Plugin's Stylesheet, since it is being called after my Custom Stylesheet, where the Plugin is performing unwanted overrides of the Custom Stylesheet.
Instead, I want to remove the Plugin's Stylesheet; copying only required styles into the Custom Stylesheet.
I tried placing the following into the functions.php
file, within the Child Theme:
<?php
function dequeue_dequeue_plugin_style(){
wp_dequeue_style( 'plugin-css' ); //Name of Style ID.
}
add_action( 'wp_enqueue_scripts', 'dequeue_dequeue_plugin_style', 999 );
?>
Unfortunately, this did not work. Is anyone able to see if I have gone wrong with my Code or whether Plugin Styles have priority over all files within a Child Theme etc.
Share Improve this question asked Feb 13, 2018 at 20:15 CraigCraig 3581 gold badge2 silver badges20 bronze badges 2 |2 Answers
Reset to default 3My error. All I had to do was knock off the -css
and it worked.
Working code:
<?php
function dequeue_dequeue_plugin_style(){
wp_dequeue_style( 'plugin' ); //Name of Style ID.
}
add_action( 'wp_enqueue_scripts', 'dequeue_dequeue_plugin_style', 999 );
?>
You can easily do it. For style, you have to follow the following codes-
function scp_assets_dequeue() {
wp_dequeue_style( 'wpcp-slick' ); // style id
}
add_action( 'wp_enqueue_scripts', 'scp_assets_dequeue', 9999);
Similarly for script, you have to try the following code-
function scp_assets_dequeue() {
wp_dequeue_script( 'wpcp-slick' ); // script id
}
add_action( 'wp_enqueue_scripts', 'scp_assets_dequeue', 9999);
本文标签: wp enqueue scriptHow can I dequeue a Plugin Stylesheet
版权声明:本文标题:wp enqueue script - How can I dequeue a Plugin Stylesheet? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741455509a2379733.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
-css
, the code works. – Craig Commented Feb 13, 2018 at 20:21