For example I have a render-blocking CSS with this URL according to PageSpeed Insights: https://groupcbm.com/wp-content/themes/deon/assets/css/grid.min.css?ver=6.2, how do I deque and deregister this?
- Locate where in the theme it registers and enqueues this file
- Once located, note down the handle it uses
- Remove it, by calling
wp_dequeue_style
orwp_dequeue_script
in a theme/plugin/etc
- make sure your dequeuing code runs after the theme has enqueued it, you can do this by setting the priority of your hook with the dequeue function calls higher than what the theme/plugin that enqueues it uses
How Do You Locate It?
Two options:
- Manually read the code
- Open the codebase in an editor and search the folder for the name of the file.
Important Note
If any of the following are true, these instructions won’t work and you will need to read and understand the theme to proceed:
- if it hardcodes the file instead of using the enqueue system
- if it loads the file from javascript instead of PHP
- if it does not mention the filename explicitly, e.g. if it passes it via a variable
If any of these are true, you will need to ask other people who use that theme about the specific method to use, or more likely the theme authors.
_Note that while you mentioned a grid.css
file in the Deon theme as an example I cannot give specific instructions for that theme as it’s a premium 3rd party theme, and 3rd party themes/plugins are offtopic here. If the generic instructions don’t work for you, you will need to contact the theme author.