Question

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.

Was it helpful?

Solution

My 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 );
?> 

OTHER TIPS

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top