Hey guys if you’re using a WordPress theme and sometimes you might don’t want to see some certain CSS (styles) or JS (scripts) files from your WordPress theme. And in case you’re in good stand to use the strong relationship of parent-child theme in yoour project and willing to remove unnecessary styles and scripts. So when it comes to WordPress themes as it comes with really unwanted scripts which might you feel unwanted on the grounds of higher server requests or a conflict is occuring. So in this post i’ll show you how to do it without any plugins and it’s very easy and simple to do it.
You can dequeue & deregister your styles & scripts files by passing them into this two action hooks:
and simple hook it differently.
To dequeue a stylesheet, use wp_dequeue_style plus the handler name in the quote
and you’re done and now let’s see the example of code and in the example it’ll remove themesfinity-shortcodes.css and myscript.js files
To dequeue Styles:
To dequeue Scripts
Possible the best way to use this is to deregister it with dequeuing and always first dequeue it first and then deregister it as i shown in the above code example. The most important thing that you should be very careful when you dequeue the scripts and styles and just need to know the correct handle of the script.