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!
Serdar Sanri
Sr. Frontend Developer
You mean Single Page Application a.k.a SPA. You have two options. rewire your current WP and use ajax based page requests, or you rewrite your website with a framework like React, Angular, Vue to make it modular. In the end neither will reload your page, but all content changes happen in shadows :)