I'm trying to removed a stylesheet which a WordPress plugin has included as I'm restyling the whole output of the plugin so don't require the stylesheet they've included.
The plugin in question is AI Twitter Feeds which includes the following CSS file into my site:
http://domain.test/wp-content/plugins/ai-twitter-feeds/css/aitwitter.css?ver=4.5.3
I've looked at the plugins file to see how it is being added and when I comment out the following line (225):
wp_register_style('aitwitter', plugins_url('css/aitwitter.css', __FILE__));
in the ai-twitter-feeds/ai-twitter-feeds.php the stylesheet included in my website disappears.
From my searching online it appears that this should not be to difficult to remove but the example code I've found online doesn't seem to have worked, see below:
function tmd_remove_plugin_assets(){
wp_dequeue_style( "aitwitter" );
wp_deregister_style( "aitwitter" );
}
add_action("wp_head", "tmd_remove_plugin_assets", 100);
I've also tried using the same function with two other hooks:
add_action( 'wp_enqueue_styles', 'tmd_remove_plugin_assets', 20 );
add_action( 'wp_enqueue_scripts', 'tmd_remove_plugin_assets', 20 );
None of these have removed the script the plugin is including, is there some mistake I've made? Or another way to remove them?