Archived topic
Dequeuing css files like featured-images
4 replies · Started by iQfy Media on April 13, 2022
I bought GeneratePress because it was listed as one of the 10 fastest themes in a test, and it hasn't disappointed. With some tweaking I've gotten my PageSpeed score to 93 for mobile and 99 for desktop, and all green on all the metrics except Largest Contentful Paint on mobile.
So there are still some tweaks I'd like to do. Some of the css files each add around 150 milliseconds to my renderblocking time, and I'd like to include them in my "custom css" file instead of loading them separately (featured-images.min for example). But, neither wp_deregister_style nor wp_dequeue_style work to stop them from being loaded. I use these wordpress functions to remove css loads from plugins just fine, but not the theme.
Ideas?
PS. I'm aware there are plugins that collapse all css and js into single files but for various reasons that isn't ideal for me.
PS2. If you added a "power user" panel to options where you can selectively unload a bunch of stuff, hopefully without adding extra mysql queries to each pageload, that would put you way ahead of the competition.
Hi there,
With regards to dequeueing styles, kindly read Elvin’s response here: https://generatepress.com/forums/topic/have-me-function-to-remove-css-and-javascript/#post-1608711
Example of how to implement it: https://generatepress.com/forums/topic/have-me-function-to-remove-css-and-javascript/#post-1608861
In the same thread, kindly take note of this as well: https://generatepress.com/forums/topic/have-me-function-to-remove-css-and-javascript/#post-1608913
Hope this helps! Kindly let us know if further assistance regarding this is needed. :)
Thank you.
Stylesheet ID (minus the "-css" at the end) was what I needed, not the stylesheet filenames. So wp_deregister_style('generate-blog-images'); did the trick.
You’re welcome! Glad that worked! Feel free to reach out anytime you’ll need assistance with anything else. :)