Beware the plugin

If you spend a lot of time optimising your WordPress site you might want to double check all those plugins you’ve activated don’t undo all that hard work.

Moving javascript to the bottom of the page, gzipping as much as you can, adding expires headers and entity tags are all things developers will be familiar with as part of the ySlow rating system. Just be careful you don’t undo all that hard work with your plugins.

This post is aimed at WordPress plugin users (I use it on this site) and after reading a couple of great articles about speeding up your website I thought I’d throw out a cautionary notice about WordPress plugins hijacking all your hard work.

Implementing the various suggestions from ySlow can be a laborious process, it’s well worth the effort though because done right, the speed improvements are very noticeable and significant.

Unfortunately, you can actually undo some of your hard work by not checking your plugins after you switch them on because many of them are written to add in calls to their own JS in the head of your site. This can be problematic if you add all your JS in the footer file.

What to do?

Depends how far you want to take it really. I’ve sometimes switched on a plugin to find it’s added as many 5 new JS files into the head of my site (Disquss comment system I’m looking your way) and some of these are tricky to strip down and rework into the footer.

Others you can though, and if you really want to push the boat out, check out this write up on registering your JS like a WordPress master.

Don’t fear editing plugins

On many of the WordPress plugins it’s relatively straightforward finding the piece of code that inserts the JS into the head of your document.

If possible, I usually strip out the code and add it into a “sitewide-settings.js” file that I call in my footer and then remove the plugin code that inserts JS into the header.

It’s a little extra work but if you’re gunning for top marks on a ySlow test, it’s worth bearing this in mind and playing around with your plugins if you can.

Posted 4 years ago on · Permalink