Title: Dequeue styles via code doesn&#8217;t work
Last modified: April 18, 2024

---

# Dequeue styles via code doesn’t work

 *  Resolved [grahambudd](https://wordpress.org/support/users/grahambudd/)
 * (@grahambudd)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/dequeue-styles-via-code-doesnt-work/)
 * In the `live-search-results.php` file there are these notes:
 *     ```wp-block-code
        * Some base styles are output in wp_footer that do nothing but position the
        * results container and apply a default transition, you can disable that by
        * adding the following to your theme's functions.php:
        *
        * add_filter( 'searchwp_live_search_base_styles', '__return_false' );
        *
        * There is a separate stylesheet that is also enqueued that applies the default
        * results theme (the visual styles) but you can disable that too by adding
        * the following to your theme's functions.php:
        *
        * wp_dequeue_style( 'searchwp-live-search' );
       ```
   
 * However adding these two items in the theme’s `functions.php` file does not appear
   to have any impact on the styles that are loaded. Changing the backend CMS settings
   for Results -> Include Styling does appear to correctly limit those styles from
   being included. Is there a correct way to implement those functions in code?

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

 *  Thread Starter [grahambudd](https://wordpress.org/support/users/grahambudd/)
 * (@grahambudd)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/dequeue-styles-via-code-doesnt-work/#post-17696845)
 * It appears that a priority greater than 20 is needed to dequeue the styles. So
   this works:
 *     ```wp-block-code
       function custom_search_dequeue_scripts() {
       	wp_dequeue_style( 'searchwp-live-search' );
       }
       add_action( 'wp_enqueue_scripts', 'custom_search_dequeue_scripts', 21 );
       ```
   
 *  [Elio Bruno](https://wordpress.org/support/users/ambrelio/)
 * (@ambrelio)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/dequeue-styles-via-code-doesnt-work/#post-17696853)
 * Hi [@grahambudd](https://wordpress.org/support/users/grahambudd/),
 * The code sample should work as expected.
 * If you add this hook, the dropdown will not be positioned under the search bar:
 *     ```wp-block-code
       add_filter( 'searchwp_live_search_base_styles', '__return_false' );
       ```
   
 * To dequeue the visual styles instead, you can use this code
 *     ```wp-block-code
       add_action( 'wp_enqueue_scripts', function () {
       	wp_dequeue_style( 'searchwp-live-search' );
       }, 30 );
       ```
   
 *  [Elio Bruno](https://wordpress.org/support/users/ambrelio/)
 * (@ambrelio)
 * [2 years ago](https://wordpress.org/support/topic/dequeue-styles-via-code-doesnt-work/#post-17788534)
 * Hi [@grahambudd](https://wordpress.org/support/users/grahambudd/),
 * I am closing this ticket as resolved as there were no more responses.
 * But if you still have issues, please feel free to reopen it!
 * Thanks

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

The topic ‘Dequeue styles via code doesn’t work’ is closed to new replies.

 * ![](https://ps.w.org/searchwp-live-ajax-search/assets/icon-256x256.png?rev=3119393)
 * [SearchWP Live Ajax Search](https://wordpress.org/plugins/searchwp-live-ajax-search/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/searchwp-live-ajax-search/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/searchwp-live-ajax-search/)
 * [Active Topics](https://wordpress.org/support/plugin/searchwp-live-ajax-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/searchwp-live-ajax-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/searchwp-live-ajax-search/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Elio Bruno](https://wordpress.org/support/users/ambrelio/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/dequeue-styles-via-code-doesnt-work/#post-17788534)
 * Status: resolved