“Smush” your images
If you’re using Adobe Photoshop, you can use the “Save for web” option that allow you to easily find the best compromise between quality and image size. Another option is to use a free online service to reduce image size while keeping its quality high. This service is called Smush It and I can’t stop using it to optimize my images.
There’s also a free WordPress plugin available. Install it, and it will automatically optimize any image you’ll upload to your WordPress site using the uploader. Cool, isn’t it?
Use a caching plugin
If your WordPress site is slow, make sure you’re using a caching plugin. There’s lot of options available, however I recommend W3 Total Cache which is free and really efficient.
W3 Total Cache minify static files (CSS, JavaScript), cache .php
files, and add easy CDN support.
Reduce database queries
It is important to reduce unecessary queries to your database as each query take a few milliseconds to execute. First, you might want to know how many queries your blog execute in order to display a page. To do so, paste the code below in your functions.php
file. Once done, just have a look to your site footer to know how many queries has been executed and how many time it took to completely load the page.
add_action( 'wp_footer', 'tcb_note_server_side_page_speed' );
function tcb_note_server_side_page_speed() {
date_default_timezone_set( get_option( 'timezone_string' ) );
$content = '[ ' . date( 'Y-m-d H:i:s T' ) . ' ] ';
$content .= 'Page created in ';
$content .= timer_stop( $display = 0, $precision = 2 );
$content .= ' seconds from ';
$content .= get_num_queries();
$content .= ' queries';
if( ! current_user_can( 'administrator' ) ) $content = "<!-- $content -->";
echo $content;
}
Then, you have to remove useless queries from your blog. Start by making sure that you are not using too many plugins, as most plugins are making database queries. Then you can remove theme-related queries that are not useful to your blog.
Speed up your site with .htaccess caching
If you can’t or don’t want to use a caching plugin on your WordPress site, this code snippet might be very helpful for you.
By using some simple .htaccess
file caching, you can dramatically increase your website speed. This snippet must be pasted in your .htaccess
file, located at the root of your WordPress install.
# 1 YEAR
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=172800, proxy-revalidate"
</FilesMatch>
# 1 MIN
<FilesMatch "\.(html|htm|php)$">
Header set Cache-Control "max-age=60, private, proxy-revalidate"
</FilesMatch>
Source: http://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching.html
Use a Content Delivery Network
Do you know that 80 to 90% of the end-user response time is spent downloading all the components in the page? Images, scripts or stylesheets can take a while to be downloaded on the client machine.
A content delivery network (CDN) is a collection of web servers distributed across multiple locations to deliver content more efficiently to users. Although CDNs are pricey for small or non-profit websites, using this solution can really make your site 20% faster. Most well known CDNs are MaxCDN, Amazon CloudFront, CloudFlare and NetDNA.
Minimize HTTP requests
In order to reduce page loading time, you have to reduce the number of HTTP requests. To do so, you have to:
- Reduce the number of JavaScript files
- Reduce the number of CSS files
- Reduce the number of images
If you’re using W3 Total Cache as I recommended, you don’t have to worry much about JavaScript and CSS files, as the plugin minify those files in order to reduce the number of HTTP requests.
Regarding images, one of the best thing to do is to using the “CSS sprites” technique. This technique basically consists of grouping many small images on one big image in order to do a single HTTP request all for images, instead of one request per image. The easiest way to combine your images on a single image file and automatically generate the corresponding .css
code is to use a service named Sprite Me.
Use a reliable web hosting
At last but not least, it is obvious that you should use a reliable web host if you want your website to be fast. I’ve used lots of web hosts and some are really good and some other sucks. For example, you should definitely avoid Phpnet.org and Maven Hosting, both of them shut my websites down just because they were receiving too many visits.
On the other hand, I was pleased with WP Web Host, which is really good if you’re hosting a small or medium WordPress site or blog. If you have a popular and/or large website, I definitely recommend Vidahost, which is CatsWhoCode webhost. My site is still fast although I receive lots of traffic. If you want to get some hosting from Vidahost, don’t forget to use my custom coupon CATSWHOCODE to get 10% off anything.
Btw, if you need any help with your website, I can help you at avery reasonable rate. Have a look at my site WPCAT to get in touch!