Smart ways to optimize WordPress site

This tutorial will show how to reduce the CPU load on WordPress site. The fact is that you will never want a slow server which might affect your Google page ranking, a constant server crash or your web hosting company shutting off your site without warning due to excessive usage of CPU resources.

Here I will show you some of the important methods to optimize your WordPress site.

Enable caching

Enabling caching for your website can boost its speed significantly because caching ensures a much faster experience for your website users by storing a version of your website on their browser and serving them that version until your website is updated or until you instruct it to refresh the version of your website they are served.

When you use CMS like WordPress then the higher version of WordPress comes with a feature known as Object Cache but it is by default not enabled, so you can enable it by following way

Step 1. Login to your hosting server cPanel

Step 2. Go to the root directory of your WordPress application

Step 3. Edit the wp-config.php file

Step 4. Update or insert the following line in the above file


Step 5. When you enable the cache, then cached files must be kept somewhere in the sever, so create the following directory


Step 6. Change the permission of “cache” folder as 755 or 777 so that the caching would be writable into this folder

If you want you can also set expiration time to WordPress Object Cache by inserting the following line in the wp-config.php file


Note : If you do not want to use WordPress Object Cache then you can use any one of the following good caching plugins

W3 Total Cache

WP Super Cache

Choose good WordPress theme

Choose simple WordPress theme for your blog site, because your theme is the face of your site and plays an important role in how users and search engines perceive it.

Many WordPress themes come with lots of customization options. If the theme is not coded properly, these options can make it difficult for you to modify themes. Therefore either you will be locked into that theme or need to pay a developer to help you switch.

On the other hand, some WordPress themes which look really great actually make your website incredibly slow. And no one likes slow websites, particularly Google, which prefers to rank faster websites higher.

A well coded theme will greatly reduce the number of queries, have minimal W3C error and is Google friendly.

The the theme should be Responsive because these themes adjust their layout across different screen sizes and devices. A significant number of site’s traffic is generated from mobile, tablets and other handheld devices. Depending on your website’s topics, this number could go even higher than 50% of your traffic.

Lazy Load Images

Lazy load images to improve page load times and server bandwidth. Images are loaded only when visible to the user. You can use WordPress Lazy Load plugin that is very useful with lots of images.

Enable GZip Compression

Gzip is, also a file format, a method of compressing files to make them in smaller size for faster network transfers.

GZip Compression

Compression allows your web server to provide smaller file sizes which load faster for your website users.
Enabling gzip compression is a standard practice. If you are not using it for some reason, your webpages are likely slower than your competitors.

Check details how to enable GZip Compression in different ways for different servers

If you use W3 Total Cache or WP Super Cache plugin then GZip compression is automatically performed.

The following URLs may be useful for testing whether your site has GZip Compression enabled or not

Is My Blog Working

Arul’s Gzip Tester for Website

Search Engine Optimization(SEO) Tools

Clean WordPress wp_options table

When you install and activate a new plugin, it stores plugin configurations in the MySQL ‘wp_options’ table. It may be a good idea to clean the WordPress wp_options table. You can do cleanup manually by logging to the cPanel, there should be a tool there called PHPMyAdmin. Using PHPMyAdmin, you can directly view and manage all your MySQL databases.

Remember to backup of your database & deactivate and delete unused plugins before performing the cleaning up process.

You can use the WP-Sweep plugin for this purpose. WP-Sweep allows you to clean up unused, orphaned and duplicated data in your WordPress to optimize your database tables.

There are two old plugins which may be useful for cleaning up the database

Option Optimizer
Clean Options

Use a Content Delivery Network (CDN)

If you website is hosted on servers in the US then the website will generally be fatser for people living in the US or people visiting with a US VPN but your website will be slower for people from other parts of the world. It is also true if your website is hosted on servers in India then people visiting your website from India will be faster and people from rest of the world will be slower.

Therefore CDN comes to rescue by distributing your website files across a network of servers in different locations of the world so that someone trying to visit from other part of the world where your website is not hosted will see significant increase in your website speed. For this you do not need any plugin or special software. You do not even have to spend much on another web hosting plan – simply upload the images to a CDN.

Here are some CDN options:

JetPack (Free)
Amazon (Free & Paid)
Cloudflare (Free & Paid)
MaxCDN (Paid)

Optimize Images

Optimize your images by reducing size because un-optimized images consume a lot of server resources and take a longer time to load due to heavy size of the images. If the average size of the images is more than 1MB then you have got to do serious work on it. You can significantly reduce the size of your image to  reduce the server’s load and web hosting bandwidth while ensuring that its quality is not negatively impacted by using any of the following tools:

WP Smush
EWWW Image Optimizer
CW Image Optimizer

Compress Javascript and CSS Files

You may have lots of JavaScript and CSS files for your website and if these files are not minified then it leads to a lot of requests for downloading those files while visitors are browsing pages in your website. Hence it eventually impacts your website speed negatively. By removing empty spaces, comments, redundant codes and line breaks, the size of individual JavaScript and CSS files are reduced, thus translates into a massive bandwidth saving.

You can use any one of the following tools to compress your CSS files

CSS Compressor
Clean CSS

You can use JavaScript compressor tool

JavaScript Compressor

If you use any one of the below tools then CSS, JavaScript files are automatically compressed

W3 Total Cache

WP Super Cache

Minimize the Number of Plugins

Keep plugins which are required only. We know that plugins help enhance your website’s functionality and look & feel but it is also important to only use a plugin if you feel that it is absolutely necessary. Because, unnecessary plugins can reduce your website speed significantly and it is especially important to pay attention to them if you are using blogging CMSs like WordPress or Joomla.

It is very important to keep in mind that it is not always the number of plugins you have installed but also about the quality of the installed plugins. Sometimes a website installed with 20 plugins may be faster than a website installed with 5 plugins due to the poor quality of the 5 plugins installed in the website. The poor quality plugin, that performs a lot of extra database queries and remote requests, should always be avoided.

Enable HTTP Keep-Alive

When visitors browse pages in a website then many files are requested by the browser from web server for a page to be displayed on the browser. So each time http connection is opened and closed for a file that is loaded from the web server. This uses more CPU, network & memory and eventually leads to a slower website if there is a lot of load on your server. Enabling http keep-alive ensures that all files are loaded through a single opened connection from the server which leads to a more faster website while visitors are browsing the website. It also reduces the extra burden on the web server.

The http keep-alive can be done through htaccess

<ifModule mod_headers.c>
    Header set Connection keep-alive

Prevent Others from Hotlinking Your Images

Hotlinking refers to linking directly to non-html objects on other servers, such as images, movie, css, zip, pdf files etc. This can greatly impact bandwidth usage because when people hotlink your images, they are basically stealing your bandwidth since a request will be made to your server every time their readers tries to view the images on their website. Hotlink protection can save you lots of bandwidth by preventing other sites from displaying your non-html.

You can check how to do it here

Test the speed of the WordPress site

After optimizing your website it is important to test whether your website speed got optimized or not. There are online applications available that do this for free including favorite Google PageSpeed Insight.

Google PageSpeed Insight
Pingdom Website Speed Test

Thanks for reading.

Leave a Comment