My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How can I keep plugin's scripts and stylesheets from loading in every page?

Kevin C.'s photo
Kevin C.
·Jan 3, 2019

How can I keep scripts and stylesheets that plug-ins use from loading in every page? For example, I have an email contact form plug-in that uses JavaScript for checking and rendering error messages and some stylesheets for styling its forms. The problem is that it loads those files on every page regardless of whether it has the form. I want to keep them from loading in all but the page that actually has the form.

It's one of a few major gripes I have about WordPress in general. It's incredibly wasteful!