Title: dequeue certain styles and scripts not working
Last modified: September 19, 2024

---

# dequeue certain styles and scripts not working

 *  Resolved [rose18](https://wordpress.org/support/users/rose18/)
 * (@rose18)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/dequeue-certain-styles-and-scripts-not-working/)
 * Hi,
 * We are trying to dequeue unnecessary styles and script on the front-end, and 
   it’s not working for some. 
   I followed this post: [https://wordpress.org/support/topic/dequeue-styles-and-scripts-for-frontend-optimisation/](https://wordpress.org/support/topic/dequeue-styles-and-scripts-for-frontend-optimisation/)
 * I am trying to dequeue the scripts and styles below, but it’s not working when
   I use the ‘wpgooglemaps_hook_user_js_after_core’ hook or these other hooks (‘
   wpgmza-get-library-dependencies’ + ‘wpgmza_script_loader_enqueue_styles’)
 * **css:-featherlight
   -wpgmaps_datatables_responsive-style
 * **js:-featherlight
   -polyline-wpgmza_canvas_layer_options-wpgmza_canvas_layer
 * what hooks should we use to dequeue those?
 * thanks!

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

 *  Plugin Author [DylanAuty](https://wordpress.org/support/users/dylanauty/)
 * (@dylanauty)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/dequeue-certain-styles-and-scripts-not-working/#post-18024057)
 * Hi [@rose18](https://wordpress.org/support/users/rose18/),
 * Thank you for getting in touch, we do appreciate your time.
 * As all of the mentioned dependencies are non-essential (not core) modules, you
   only need to dequeue these using the ‘wpgooglemaps_hook_user_js_after_core’ hook,
   I’ve prepared a specific code block for you:
 *     ```wp-block-code
       function wpgmza_dequeue_additional_dependencies(){    wp_dequeue_style('featherlight');    wp_dequeue_script('featherlight');    wp_dequeue_style('wpgmaps_datatables_responsive-style');    wp_dequeue_script('wpgmza_canvas_layer_options');    wp_dequeue_script('wpgmza_canvas_layer');    wp_dequeue_script('polyline');}add_action('wpgooglemaps_hook_user_js_after_core', 'wpgmza_dequeue_additional_dependencies', 9999);
       ```
   
 * This has been tested on my side and works as expected. If it is not working on
   your side, I’d need to know a bit more about how you’re adding this PHP to your
   site?
 * We recommend adding it to the functions.php file of your child theme, to ensure
   it loads correctly to dequeue these assets.
 *  Thread Starter [rose18](https://wordpress.org/support/users/rose18/)
 * (@rose18)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/dequeue-certain-styles-and-scripts-not-working/#post-18024989)
 * [@dylanauty](https://wordpress.org/support/users/dylanauty/) thank you! but adding
   your code block still doesn’t work for me, the frontend is still loading those
   files. 
   I added the code to my functions.php file in my child theme.
 *  Thread Starter [rose18](https://wordpress.org/support/users/rose18/)
 * (@rose18)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/dequeue-certain-styles-and-scripts-not-working/#post-18025168)
 * [@dylanauty](https://wordpress.org/support/users/dylanauty/) – Also to add, I
   have WP Go Maps Pro plugin installed, does that affect the code that you’ve provided?
   thanks!
 *  Plugin Author [DylanAuty](https://wordpress.org/support/users/dylanauty/)
 * (@dylanauty)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/dequeue-certain-styles-and-scripts-not-working/#post-18026244)
 * Hi [@rose18](https://wordpress.org/support/users/rose18/),
 * Thank you for getting back to me, I do appreciate it.
 * That is quite strange as this same code has been used on many sites (including
   our own development sites) and works without issue. I suspect there may be some
   additional layer of functionality preventing our code from taking affect.
 * Unfortunately we aren’t allowed to discuss any Premium features/questions via
   these threads, as per the WordPress.org guidelines.
 * Would you mind opening a support ticket [on our website](https://wpgmaps.com/contact-us)
   instead so that someone from my team can work more closely with you on this to
   get it sorted?

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

The topic ‘dequeue certain styles and scripts not working’ is closed to new replies.

 * ![](https://ps.w.org/wp-google-maps/assets/icon-256x256.png?rev=3058363)
 * [WP Go Maps - Google Maps, OpenStreetMap, Leaflet Map](https://wordpress.org/plugins/wp-google-maps/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-google-maps/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-google-maps/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-google-maps/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-google-maps/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-google-maps/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [DylanAuty](https://wordpress.org/support/users/dylanauty/)
 * Last activity: [1 year, 8 months ago](https://wordpress.org/support/topic/dequeue-certain-styles-and-scripts-not-working/#post-18026244)
 * Status: resolved