My latest plugin, oik-unloader, is a WordPress performance improvement plugin. Its job is to unload unnecessary plugins on demand. This post explains what it does and documents the results of my performance tests to determine the effectiveness of this plugin on live sites. Before we dive into that, let’s have a look at some of the top performance tips.
10 top tips to improve WordPress performance
If you do a search for “WordPress performance improvement” you’ll probably find a number of posts listing tips for optimizing your WordPress website. Here are ten of the top tips.
- Choose a good WordPress host
- Use a fast theme
- Optimize your images
- Minimize your homepage
- Remove plugins you don’t use
- Use inline CSS/JS or minified files
- Use excerpts on home page and archives
- Use a caching plugin
- Optimize your WordPress database
- Use a Content Delivery Network (CDN)
How to improve performance
One way to make your site faster is to give it more computing power. Another way is to make the server do less. And a third way is to make the browser do less.
Let’s classify the top 10 using these methods.
- Choose a good WordPress host – more computing power
- Use a fast theme – server do less, browser do less
- Optimize your images – browser do less
- Minimize your homepage – server do less, browser do less
- Remove plugins you don’t use – server do less, and potentially browser do less
- Use inline CSS/JS or minified files – browser do less
- Use (hand crafted) excerpts on home page and archives – server do less
- Use a caching plugin – server do less for repeat requests, certain users
- Optimize your WordPress database – server do less
- Use a Content Delivery Network (CDN) – server do less
Let’s look at the first five in a little more detail.
Choose a good WordPress host
If you don’t have good hosting then you’re just pissing into the wind. You’re trying to get your site to respond to each request in under half a second. If you can’t get one request to run in half a second then you’re stuffed. My sites aren’t particularly busy, but as you’ll see from the results below my hosting is good enough at present. By the way, I use SiteGround. And on some sites I’m also using the SiteGround Optimizer plugin.
Use a fast theme
A fast theme will be coded efficiently to reduce both server and browser processing. It will satisfy tip 6. It may also help you satisfy tips 4 and 7. Full Site Editing themes appear to be a lot faster than many premium themes.
Optimize your images
There are “new” image formats and compression techniques which allow image file size to be much smaller while still looking good. See Image size reduction by quality WordPress has started to introduce support for these images – allowing WebP files (
.webp). But WordPress core doesn’t cater for legacy uploads of JPGs and PNGs, nor fallback on devices/browsers which can’t display the new image formats. There are plugins that are designed to help, for example WebP Express. Using WebP Express may help the browser, but there could also be a small server overhead.
Minimize your homepage
Remove plugins you don’t use
Now we’ve got to the tip that my new plugin addresses. You’ve got all these plugins in your site. It’s likely that each one was installed to perform a particular purpose. There’s definitely somewhere in your site that the plugin is needed. But is it needed on the home page? Some plugins are only used in the admin pages. Others provide blocks, shortcodes or some other functionality that’s only needed in specific areas of the site? Do these plugins play nicely and only do things when required or do they assume that they’ll always be needed?
There’s a small but measurable overhead for each plugin file that’s loaded, each function that’s run and each database access performed.
One way to make your server do less is to reduce the number of activated plugins. Wouldn’t it be nice to be able to do this on demand.
Keep the plugins you really do need, but only load them when actually required.
oik-unloader: WordPress performance improvement plugin
Remove plugins you don’t use, but only when you’re not using them.
Herb Miller, October 2021
The oik-unloader plugin is a general purpose WordPress performance improvement plugin that deactivates plugins on demand.
For each URL where you’re trying to improve performance, you tell it which plugins you don’t need to be activated. It will dynamically deactivate these plugins, which means they won’t get loaded. In other words they’re unloaded. This should make your server do less.
There is also the chance that the site visitor will notice the browser do less because
- the plugin is no longer delivering content to the browser
- which means the browser doesn’t have to do things with that content:
- render HTML,
- load and display images,
- style content with the CSS
How the oik-unloader plugin works
oik-unloaderplugin delivers a WordPress Must Use plugin called
- This MU plugin uses a configuration file to determine which plugins to deactivate.
- For each request it uses the current URL to decide which plugins should not be activated.
- When WordPress is loading plugins it removes the selected plugins from the list.
How to use the oik-unloader plugin
You use the same process for each URL where you believe you can improve the server performance.
- From the WordPress admin menu choose Settings > oik unloader
- If not already present type the New URL and press the Add URL button.
- Use the URL select box to identify the URL to change and press Choose URL to update
- Select the plugins to be deactivated using the checkboxes.
- Press the Update plugins to deactivate button to apply your changes.
- If you no longer need to improve the performance of an URL use the Delete URL button
- Each time you perform an update the changes will be applied immediately.
- Test the results by viewing the URL in another browser window or tab.
- Note: You may need to clear a cache.
Unlike many other MU plugins this one can be managed using the oik-unloader-mu box in Settings > oik-unloader
To install the MU plugin choose the Click to activate/update MU link. The MU plugin can be uninstalled using the Click to deactivate MU link.
Alpha testing oik-unloader on live sites
So the question is, does the oik-unloader WordPress performance improvement plugin actually produce measurable results?
I performed a number of tests to attempt to improve the performance of the home URL on some of my live sites.
I measured the Server side response using my oik-bwtrace plugin, with requests being driven by, and results compared, using the Slog plugin. For more information see Does my site run slow with this?
I used Lighthouse to measure the performance in the browser for both Mobile and Desktop.
Server side response test
The following charts shows the effect on server side response of deactivating a bunch of plugins on the home URL of oik-plugins.com and oik-plugins.co.uk, two sites with almost identical content.
- Step 1 summarises the server response before the plugin is installed
- Step 2 summarises the server response when the main plugin is installed
- Step 3 summarises the server response when the MU plugin is installed
- Step 4 summarises the server response when the selected plugins are deactivated
- I expect the results from step 4 to be better than for steps 1, 2 and 3.
- If not there's something wrong.
- I expect the results for step 1 to be marginally better than the results for step 2; in step 2 another plugin is activated.
- Ditto for step 2's results to be marginally better than step 3, where the MU plugin is also being loaded.
- With a small number of requests being measured the results can appear inconclusive.
- I ran fewer requests on oik-plugins.com than I did on oik-plugins.co.uk
- For oik-plugins.com I deactivated 33 plugins for step 4.
- On oik-plugins.co.uk I deactivated 29.
- Then I went a step further and deactivated Yoast SEO - step 4b
- The chart indicates that Yoast SEO adds up to 0.03 of a second to each server response.
- It's creating output intended for search engines and other websites that's hardly ever viewed by humans.
Lighthouse performance tests
Using the Lighthouse Chrome Extension I measured the Performance for both Mobile and Desktop.
- Before is equivalent to step 1 - measuring the Performance before the plugin is installed
- Installed is equivalent to step 2 or 3 - when the MU plugin is installed but no plugins are being dynamically deactivated
- Configured is equivalent to step 4.
We expect the Configured performance to be higher than the Before performance.
Notes on running Lighthouse tests
- Before running any Lighthouse performance test you should
- Ensure that any cacheing is cleared and re-primed. This may need to be done from the hosting control panel.
- Ensure that any tracing or logging is disabled.
- Consider setting
- It's best to run Lighthouse in an Incognito window.
- Load the URL you want to visit. Check it looks and behaves how you expect it to look and behave.
- Then run the Lighthouse tests, at least once for each of Mobile and Desktop, averaging the results.
Comments on the results
- In most cases I was able to achieve some improvement.
- The detailed report often recommended image optimization - tip 3.
- I attribute the very poor results for wp-a2z.org to Google Ads
- I didn't run enough tests to get good average figures. I wouldn't have expected the Performance for Before and Installed to be any different.
- Better results were harder to achieve on WordPress Multi Site ( oik-plugins.uk and wp-a2z ) due to current limitations of the plugin,
The initial results are promising.
- Dynamically deactivating plugins that aren't needed can improve the server response time.
- Dynamically deactivating plugins that aren't needed can improve the browser performance figure
- When Lighthouse tests are already reporting 100 you might want to focus on improving the performance of other URLs
- I need to do more work to support WordPress Multi Site better
- Publish the plugin on oik-plugins.com.
Done: Download the plugin from oik-unloader: deactivate plugins on demand
- Add logic to support deactivation of Network Activated plugins in WordPress Multi Site.
- For each site find a poor performing URL and attempt to improve the performance
- Test the effect with multiple URLs
- Test the effect with archive URLs
- Find some slower sites to test and see how much improvement can be achieved.
- Investigate options for varying the deactivation depending on the requester.
- Remove the Google Ads from wp-a2z.org.
Done: I removed the ads from the home URL.
- Investigate using Lighthouse on the command line for performing repetitive tests.
Update for Network Activated plugins
I've developed changes in oik-unloader v0.1.0 to support deactivation of Network Activated plugins in a WordPress Multi Site network.
Here are new figures for the home page on oik-plugins.uk and blocks.wp-a2z.org