.. Your Daily Design Dosis

How to Optimize your WordPress site for Performance

| 6 Comments

Site speed has been used as a signal for rankings since 2010, your website’s performance is one of the key factors in ensuring that your visitors are having a good experience reading your site. Personally I therefore think it’s worthwhile to spend some time tuning/optimizing your site for performance. There are lots of benefits of having a superduper fast site!

When you are building a website, it is essential to consider its loading speed. Experts believe that slower sites get fewer visitors as compared to faster websites. Optimizing your WordPress theme for speed and maximum performance will lead to a positive change.

Before diving into the optimization tips and tricks, I recommend measuring the current performance of the site so you have some benchmarking figures to compare against after you make the changes and see how it has affected the performance. You can use tools like Page Speed tool to check how your site scores.

In this article I want to give you some solid and basic tips and tricks to optimize your WordPress site. I know there are a lot of plugins out there to help you optimize your blog but I will not go in full detail on those in this article.

WordPress Installation

Always keep up with the latest WordPress version. This will ensure that your site will run at its optimal performance and remain secure.

Use a good, well-coded Theme

Check your theme code (valid HTML code). Valid markup language is absolutely vital for page speed and SEO rankings so make sure your theme looks good. Remove unused code, this saves bytes and minimizes bandwidth use.

By combining your CSS files into one and JS files into one you will significantly save HTTP requests. If you don’t know how to combine, minify and compress the JS/CSS resources loaded, here’s a plugin that can do this for you: JS & CSS Script Optimizer or Better WordPress Minify.

The drastic increase of JavaScript content is probably tied to the rise of HTML 5, with websites using JavaScript as an increasingly important part of a dynamic web experience. Instead of placing tons of code in your header.php file, use external scripts. This allows the browser to cache the script so it won’t have to read it for every other page.

Plugins

First of all, clean up WordPress from unused plugins and themes, make sure any plugins that you are not using is deactivated or deleted, this will prevent them from loading when your site loads. Be selective in your selection of plugins. Some will have a major load on your database, ask yourself if you really need it in your website.

Bad plugins can slow down your site. If you think this is the issue try disabling all plugins and see if that helps. You can also use a Plugin Performance Profiler like P3. Second, make sure the remaining plugins and themes are updated to the most recent version. This will keep your site fast and secure.

Note: you should only download plugins from WordPress’ repository and not from third-party sites which may be phishing genuine ones or may include malware in the download.

Caching

Caching plug-ins speed up your site and lead to a number of wide-ranging benefits for users who visit and re-visit your site. The easiest way to speed up your website is to install a caching plugin: WP Super Cache and W3 Total Cache are the most popular.

I myself use WPSuperCache, which generates static html files from my dynamic WordPress blog. After an html file is generated the webserver will serve that file instead of processing the comparatively heavier and more extensive WordPress PHP scripts and will not actually load any content from the database at all, hence the post will load faster with less stress on your server.

Note: Make sure your Caching plugin is working properly and that the response is coming gzip-compressed! If this doesn’t work you can always use .htaccess Gzip compression for additional speed and compression.

Optimize and Repair your Database from myPhpAdmin

Every month or so you should login to your myPhpAdmin and optimize your database. Locate your WordPress Database Tables, check all the tables in the Check Boxes, select the Optimize Tables Option and repair. These will sequentially interrogate your database tables and auto-repair any hidden issues. This may well translate into faster database speeds for your WordPress Data.

Before doing anything with your database, make sure to backup your database before making major optimization efforts or attempting to repair tables.

Note: Keep your database optimized to reduce overhead. If you’re afraid of phpMyAdmin try the OptimizeDB plugin.

performance for WordPress

Minimize PHP and Database Queries

The number of database queries a webpage makes to load the page has an effect on the page load time. You can use the following piece of code in the footer of your theme to find out how many database queries a page is making. Some plugins can balloon your database queries through the roof as well as some WordPress menus can do.

<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.

Each time a page on your site loads, if your browser has to execute any PHP queries, it adds to the load time. If you replace the PHP queries with static HTML, every time a page loads, your browser just reads the HTML. For example, instead of using <?php get_bloginfo('wpurl'); ?> just replace it with your wordpress installation URL so the browser can simply read it instead of making a query.

Optimizing Images

Over the past year, web pages have on average become 25% bigger. Images have always been, and continue to be, the biggest single factor to page size. Their contribution to page size has also increased the most if you look at sheer file size. A great way to optimize images in several lossless ways, is to make use of Yahoo’s Smush.it

WP Smush.it offers an API that performs these optimizations (except for stripping JPEG meta data) automatically, and this plugin seamlessly integrates Yahoo’s Smush.it with WordPress.

Note: you can read more suggestions to optimize images and graphics in an earlier article here on the gonzoblog.nl

Analyze the Timeline (waterfall) Report

For this you can use Google Chrome’s Dev Tools or FireFox’s Firebug, but there are other programs that will do exactly the same, load the page in a browser and analyze its ‘timeline’ report, also referred to as ‘waterfall’. If you’re showed an extensive amount of external resources loaded, you know it’s time to clean up the sidebar from all additional widgets, or to delete some of your ‘social buttons’.

Note that report numbers don’t carry much meaning as they will most definitely vary wildly depending on client-server geographic locations and connection speeds. What matters more is the overall loading behavior and the way your changes impact it: how many resources are loaded, what resources are loaded from external (potentially slower) domains, are they compressed, combined together or minified, which resources load most sluggishly and so on.

Note: while this kinda reports are useful for spotting the most obvious bottlenecks, it provides a network-only view of the page loading process. If the ‘timeline’ report hasn’t provided you with enough data to work on, run PageSpeed or YSlow to get a detailed list of suggested optimizations.

Consider using a CDN

A CDN, otherwise known as a Content Delivery Network, allows you to store static images and large files on third-party clustered servers around the world. The user will get served the static files from the servers closest to the selected server, thus speeding up page download times and freeing up resources on your main server.

Using a jQuery CDN has many of the same benefits as mentioned above. If you use jQuery hosted on Google CDN there is a big chance most of your visitors already have the file cached in their browser so they don’t have to download it again for your site.

Good Hosting

A good hosting provider is one of the most important elements of page speed optimization and WordPress performance. You don’t want to run your site on a shared hosting service. Select a hosting solution that is close to your target audience, proximity to the web server has a huge impact on load time.

Note: Nothing slows your site down like bad hosting.

Conclusion

I still have lots of room for improvement, but at some point you have to consider the cost / benefit factor too. For now the gonzoblog is fast enough, but I’m considering to move to another hosting party where I can make use of a CDN.

- § -

If you know any other great tips or tricks to increase performance of your WordPress site, I hope you could share this in the comments with us?

 

Author: Jan Rajtoral

Jan Rajtoral AKA Gonzo the Great is the Founder of and Designer at gonzodesign, providing design services across the full spectrum of Brand Identity, Graphic Design, Print and Advertising Design & Website Design.

6 comments

on this article: “How to Optimize your WordPress site for Performance”
  1. Hello! I really like this blog. Tell me please – from where do you have information for ths post?

    • Hi vps,

      .. thanks for your kind words! As I design/develop a lot in WordPress (like this blog) these tips and tricks come from my own experience with WordPress, but also a lot I first read before trying it. The no.1 reference for WordPress MUST be the Codex tho, that’s the ‘WP Bible’ ;-P

      Have a great day, ciao!

  2. Web hosting made the biggest difference to my website speed, when I went from shared hosting to WPEngine hosting my website would load 4 seconds faster.

    • Hi Paul, buddy!

      Sorry for my late reply Paul, but was a bit busy having some deadlines here .. ahh, you know how it is ;-P

      But yeah, I totally agree with you on the topic of hosting vs pageload of your site! Another good aspect of going VPS/dedicated is you’ll no longer have other sites on your server that could be infected by a virus or malware! I have been banned twice by Google because of being on a shared server with infected (other) websites on it, shutting me down due to ‘bad’ neighborhood!

      Still I’m not fully happy with my host, have had some security and performance (CPU) issues too .., but they have a good quality/price rate? Gonna take a look at WPEngine, cuz you’re not the first person being very enthusiastic about them! So thanks for that tip buddy ;-P

      Enjoy your day Paul, talk to you later ..
      Cheers & Ciao Amigo!

  3. Yet another wp Awesome post. Wud u mind me being a co-author in this blog?

    • Hi Agbonghama,

      thanks (again) for your comment ;-P And I just replied on a latter comment here that I always can use good guest-bloggers who want to increase their web exposure as well! Email me via the contact form please, .. okay? Cheers & Ciao!

top