There are many plugins that tend to automatically add their JS and CSS files to all posts and pages of your blog even though you might be using the plugin’s functionality only on one or two pages.
For instance, a gallery plugin. You might have the gallery only on one page of your site, yet the plugin loads the required JS and CSS files on all pages. This is counter-productive and can negatively effect your site’s performance and page load speeds.
The good thing is that you can easily prevent this from happening by restricting a plugin’s scripts and styles only to specific posts and pages using the wp_dequeue_script and wp_dequeue_style functions. Here’s how.