Title: Can&#039;t dequeue a plugin css file
Last modified: August 30, 2016

---

# Can't dequeue a plugin css file

 *  Resolved [drazon](https://wordpress.org/support/users/drazon/)
 * (@drazon)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/)
 * Hi there is a plugin which adds a css file which I want to dequeue
 *     ```
       public function addStyles_frontend() {
       // Enqueue Styles
       wp_enqueue_style( 'prefix-font-awesome' , '//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' , array() , '4.3.0' );
       				}
       ```
   
 * In my child theme fucntions.php I have this code
 *     ```
       function remove_unwanted_css(){
       	wp_dequeue_style('prefix-font-awesome');
       }
       add_action( 'wp_enqueue_scripts', 'remove_unwanted_css', 100 );
       ```
   
 * But it doesn’t dequeue the css file…So what am I doing wrong?
 * Thanks

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [Tremi Dkhar](https://wordpress.org/support/users/tremidkhar/)
 * (@tremidkhar)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271310)
 * Try to add the following code
 *     ```
       function remove_unwanted_css(){
       	wp_dequeue_style('prefix-font-awesome');
       }
       add_action( 'wp_print_styles', 'remove_unwanted_css', 100 );
       ```
   
 *  Thread Starter [drazon](https://wordpress.org/support/users/drazon/)
 * (@drazon)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271432)
 * Unfortunately this doesn’t help.
    A closer look at the plugin code reveals that
   the style is enqueued from a function which is called from the plugin shortcode.
 *     ```
       public function processShortcode( $p ) {
       				// enqueue our scripts + styles
       				$this->addScripts_frontend();
       				$this->addStyles_frontend();
       .....
       }
       ```
   
 * So I guess what I have been trying so far is to dequeue a style that is not enqueued
   when running the child function.php and then the shortcode enqueues the style
   ignoring the code in functions.php which has already run. So what do I have to
   do? Replace the whole function processShortcode in functions.php?
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271434)
 * Do you need to dequeue it? Can you not just override it with CSS specificity?
 *  [Tremi Dkhar](https://wordpress.org/support/users/tremidkhar/)
 * (@tremidkhar)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271440)
 * Can you give me the link to that plugin so I can check it myself?
 *  Thread Starter [drazon](https://wordpress.org/support/users/drazon/)
 * (@drazon)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271450)
 * Yes the link is this [https://wordpress.org/plugins/timeline-express/](https://wordpress.org/plugins/timeline-express/)
   I have edited the plugin file directly which is /classes/class.timeline-express.
   php line 936. I guess that I will have to do it over and over again after every
   plugin update.
 * I don’t want to override it with css as I already have an http request to font
   awesome from the theme which is a different version than the one which the plugin
   uses. So I wanted to avoid the extra request. In addition I wanted to experiment
   with this option to see how it is possible to dequeue css files in general from
   plugins
 *  [Tremi Dkhar](https://wordpress.org/support/users/tremidkhar/)
 * (@tremidkhar)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271462)
 * Hello drazon,
    If you are taking about the style from the admin end then I hope
   these code will work for you.
 *     ```
       function remove_unwanted_css(){
       	wp_dequeue_style('prefix-font-awesome');
       }
       add_action( 'admin_enqueue_scripts', 'remove_unwanted_css', 100);
       ```
   
 *  Thread Starter [drazon](https://wordpress.org/support/users/drazon/)
 * (@drazon)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271465)
 * Hi Tremi, no I’m talking about the front end style of font awesome at line 936
 *  [Tremi Dkhar](https://wordpress.org/support/users/tremidkhar/)
 * (@tremidkhar)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271468)
 * Try these code:
 *     ```
       function remove_unwanted_css(){
       	wp_dequeue_style('prefix-font-awesome');
       }
       add_filter('wp_footer', 'remove_unwanted_css');
       ```
   
 *  Thread Starter [drazon](https://wordpress.org/support/users/drazon/)
 * (@drazon)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271470)
 * Thank you very much this did the trick and the extra http request has been removed!
   Good technique
 * So to understand wp_footer runs after the shortcode. The shortcode enqueues the
   css style but before the page is rendered wp_footer dequeues the css style, so
   the file is not requested from the browser… Is it something like that?
 *  [Tremi Dkhar](https://wordpress.org/support/users/tremidkhar/)
 * (@tremidkhar)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271490)
 * Hello drazon,
 * In the above code we have add a filter to the footer because the style is enqueued
   in the wp_footer. By filter the wp_footer it will check if the style handler “
   prefix-font-awesome” is present and dequeue it.
 * For more information on wp_footer check this [link](https://codex.wordpress.org/Function_Reference/wp_footer)
 *  Thread Starter [drazon](https://wordpress.org/support/users/drazon/)
 * (@drazon)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271491)
 * Thank you very much Tremi for Your help!
 *  [Tremi Dkhar](https://wordpress.org/support/users/tremidkhar/)
 * (@tremidkhar)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271492)
 * Anytime 🙂

Viewing 12 replies - 1 through 12 (of 12 total)

 The topic ‘Can't dequeue a plugin css file’ is closed to new replies.

## Tags

 * [dequeue](https://wordpress.org/support/topic-tag/dequeue/)
 * [wp_enqueue_scripts](https://wordpress.org/support/topic-tag/wp_enqueue_scripts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 12 replies
 * 3 participants
 * Last reply from: [Tremi Dkhar](https://wordpress.org/support/users/tremidkhar/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/cant-deque/#post-6271492)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
