Subscribe via Email

Subscribe via RSS/JSON


Creative Commons Attribution 4.0 International License
© Rakhesh Sasidharan


Initial WordPress customizations (Part 1)

Moved this blog to a new host (A Small Orange) yesterday. The blog is now a WordPress self-hosted installation rather than WordPress multi-user/ network.

Installed the WP Super Cache plugin. This makes static versions of all your dynamic pages so there are no PHP/ database calls when users access your website. Each time someone visits a WordPress page typically there are 5 steps that happen behind the scenes. The WP Super Cache plugin eliminates 3 of these 5 steps.

I use the plugin with mod_rewrite so there are no PHP calls due to the plugin either. And I use all the recommended settings, so nothing new to learn here.

Couple of things to keep in mind about WP Super Cache.

  1. Each time you update a post the cache is rebuilt. (Not sure if that’s the default setting or not but I’ve set mine that way).
  2. You can specify a manual expiration time for pages – this way even if you don’t update the blog directly, but have widgets or RSS feeds that indirectly update the blog (but which don’t trigger a cache rebuilt as above) the cache will still be rebuilt every X number of seconds. There’s two things here – (1) you set the expiration time for the pages, and (2) you have to schedule a garbage collector who removes these expired pages and actually rebuilds the cache. So that’s two timers you have to specify. I have set both to a day in my case as this blog doesn’t have any dynamically updated widgets and such.
  3. If you make changes to the theme be sure to delete the cache. As theme changes don’t count towards an update, the cache won’t be rebuilt (unless you have very low expiration and garbage collection timers). So best to manually delete the cache.

WP Super Cache is also helpful in that it will compress the pages for you. This is disabled by default, but I enabled it. It doesn’t seem to compress everything though – stuff like JavaScript etc – so to take care of these I use mod_deflate in my .htaccess file. This is pretty straightforward, and if you are lazy (like me) you can even enable it via A Small Orange’s cPanel.

Google’s PageSpeed Insights and Yahoo’s YSlow are useful browser extensions to quickly identify where a page is slow. In my case they pointed me to minify which seems to be about removing all the whitespace in your CSS and JavaScript files and combining these into one – effectively reducing the number of file requests a browser has to make to the server, and also reducing the size of the files by removing whitespace. Neat idea, actually! There are many WordPress plugins that do this – I went with WP Minify. The other minify plugins made the admin bar of WordPress disappear and so I was concerned if they are messing up anything else.

I had to make one change with WP Minify. Namely, get it to place the minified JavaScript at the bottom of the page. Without this I could see PageSpeed complain of some files missing, so I figured it be a timing issue and tried with the JavaScript in the footer. That worked!

WP Minify is cool in that it also minifies HTML.

I will probably disable WP Minify later on though, as I am in the process of switching over this blog to CloudFlare. Amongst other things CloudFlare also minifies your HTML, CSS, and JavaScript.

There’s some more stuff I am in the midst of doing (setting expiry times for couple of static elements). I’ll make note of these in another post.

Initial WordPress customizations (Part 1) by rakhesh is licensed under a Creative Commons Attribution 4.0 International License.