1

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?

2 Answers 2

1

You try:

 remove_action('aitwitter', 'text',99);
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I just tried putting it into the tmd_remove_plugin_assets() function & outside of it but it hasn't had any affect.
0

You can try using the following code and it will work for you:

function deregister_plugin_styles() {
  wp_deregister_style( 'aitwitter' );
}
add_action( 'wp_print_styles', 'deregister_plugin_styles', 100 );

I tried using it for some other plugin and it worked perfectly fine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.