Title: dequeue style files
Last modified: June 17, 2018

---

# dequeue style files

 *  Resolved [stfa76](https://wordpress.org/support/users/stfa76/)
 * (@stfa76)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/dequeue-style-files/)
 * Hello tobiasbg,
 * In order to try and improve performance on my website, I’m checking the plugin
   I have installed one by one and dequeue / enqueue each css / js files depending
   on the posts where they are required.
 * Regarding TablePress plugin, I was already able to find out how to achieve that
   for several css files :
 *     ```
           wp_dequeue_style( 'datatables-row-details' );
           wp_dequeue_style( 'tablepress-columnfilterwidgets-css' );
           add_filter( 'tablepress_use_default_css', '__return_false' );
   
           $tablePressPostId = array(62, 65);
   
           if (in_array(get_the_ID(), $tablePressPostId)){
               wp_enqueue_style ('datatables-row-details', '/wp-content/plugins/tablepress-datatables-row-details/datatables-row-details.min.css?ver=1.0');
               wp_enqueue_style ('tablepress-columnfilterwidgets-css', '/wp-content/plugins/tablepress-datatables-column-filter-widgets/css/ColumnFilterWidgets.min.css?ver=1.2');
               add_filter( 'tablepress_use_default_css', '__return_true' );
           }
       ```
   
 * But I’m still trying to find out how to dequeue / enqueue the one below please?
   `
   wp-content/tablepress-custom.min.css?ver=39`
 * Thank you for your help.
 * Best regards,
    Stephane.

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

 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/dequeue-style-files/#post-10408687)
 * Hi,
 * thanks for your post, and sorry for the trouble.
 * Instead of using the `add_filter` line here, it might be better to work with 
   the CSS file script handlers `tablepress-default` and `tablepress-custom`, just
   as you are doing with the other two scripts.
 * The relevant code for all this is in the file [https://github.com/TobiasBg/TablePress/blob/183ea0b8319b552aca2e4dc81cfe32025d93dccb/controllers/controller-frontend.php#L97](https://github.com/TobiasBg/TablePress/blob/183ea0b8319b552aca2e4dc81cfe32025d93dccb/controllers/controller-frontend.php#L97)
 * Regards,
    Tobias
 *  Thread Starter [stfa76](https://wordpress.org/support/users/stfa76/)
 * (@stfa76)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/dequeue-style-files/#post-10408696)
 * Hi [@tobiasbg](https://wordpress.org/support/users/tobiasbg/),
 * Thanks for the quick answer.
 * That’s what I already tried to do:
 *     ```
           wp_dequeue_style( 'datatables-row-details' );
           wp_dequeue_style( 'tablepress-columnfilterwidgets-css' );
           wp_dequeue_style( 'tablepress-custom' );
           wp_dequeue_style( 'tablepress-default' );
       ```
   
 * But when doing this, I’m still seeing this file being loaded:
    `http://localhost:
   8888/wordpress452/wp-content/tablepress-combined.min.css?ver=39`
 * And when adding this line:
    `add_filter( 'tablepress_use_default_css', '__return_false');`
 * The combined css is not loaded anymore but instead, I’m seeing this one being
   loaded:
    `http://localhost:8888/wordpress452/wp-content/tablepress-custom.min.
   css?ver=39`
 *  Plugin Author [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * (@tobiasbg)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/dequeue-style-files/#post-10408757)
 * Hi,
 * you will have to do all this at the right time, i.e. when the hooks have been
   added. The TablePress CSS is loaded with standard priority (see [https://github.com/TobiasBg/TablePress/blob/183ea0b8319b552aca2e4dc81cfe32025d93dccb/controllers/controller-frontend.php#L47](https://github.com/TobiasBg/TablePress/blob/183ea0b8319b552aca2e4dc81cfe32025d93dccb/controllers/controller-frontend.php#L47)),
   so your code needs to run e.g. on the same hook, but later (e.g. priority 11).
 * Regards,
    Tobias

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

The topic ‘dequeue style files’ is closed to new replies.

 * ![](https://ps.w.org/tablepress/assets/icon.svg?rev=3192944)
 * [TablePress - Tables in WordPress made easy](https://wordpress.org/plugins/tablepress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/tablepress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/tablepress/)
 * [Active Topics](https://wordpress.org/support/plugin/tablepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/tablepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/tablepress/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Tobias Bäthge](https://wordpress.org/support/users/tobiasbg/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/dequeue-style-files/#post-10408757)
 * Status: resolved