Conditionally load scripts in WordPress to boost speed
The 1st solution is easy to implement if you’re a programmer with good knowledge of PHP. The plugin will do the job for you when you configure it correctly. This post will teach you how to load WordPress scripts conditionally with plugin organizer (PO).
WPO is available in WordPress directory, and you can easily install it from your blog’s dashboard. After its installation, open WPO settings page where you’ll find five tabs, i.e., general settings, admin CSS, recreate permalinks, mobile user agents and manage the mu-plugin file. You don’t have to alter many settings. Just go through the below steps:
1: Turn on selective plugin loading option in the 1st tab and click the save button.
2: Now navigate to the Global plugins page and disable the extension that you don’t want to enable on all posts. As you can see in the below picture, I’ve disabled the loading of easy table plugin on all pages of my site.
3: Now comes the most important part of configuration. Find all posts that require the disabled plugin. Open the post and scroll down until you find the below interface.
4: Turn on the plugin that you had disabled in the 2nd step and save the post.
5: Repeat steps number 3 and 4.
The above tutorial will make sure that the selected plugin will force the content management system to load scripts conditionally only when required which in turn will improve page load time.