How to speed up and optimize WordPress website

0
643
Optimize WordPress

Whether you run a high traffic WordPress installation or a small blog on a low cost shared host, you should optimize WordPress and your server to run as efficiently as possible. This article provides a broad overview of optimize WordPress with specific recommended approaches.

WordPress is definitely one of the most widespread CMSs. However, it’s pretty slow in default configuration, especially, if the site has a lot of visitors and heavy content. Moreover, since 2010 Google has used page load times as a factor in its search ranking algorithms.

Luckily, the flexibility of this CMS suggests numerous methods to Optimize WordPress and speed up website loading time significantly. You can check your website using online tools such as Google Page Speed to track the website speed results after each step.

Below you can find a few ways to optimize WordPress. We recommend to use them when building your website.

Tips to speed up the website:

  • Choosing theme
  • Optimizing images
  • Compressing files
  • Using browser cache
  • Using caching plugins

Tips to optimize WordPress website:

  • Homepage optimization
  • Setting up LazyLoad
  • Enabling hotlink protection
  • Optimizing the database

Choosing a theme

A theme plays a key role in a website load speed. If you plan to create a busy blog, we recommend to do the research and testing to find the lightest and the most optimized theme. Specialized threads on WordPress forums are the best places to check for that. Here are two examples:

WordPress › Support » Fast theme needed?
WordPress › Support » Fast loading / low bandwidth theme: Appropedia’s 13

Optimizing images

A number of plugins for reducing image size exists on the web, for example, EWWW Image Optimizer, WP Smush.it and so on. They all have different features and allow you to find the configuration you need.

We recommend using the EWWW Image Optimizer plugin.

w3_cache

You will have an option to bulk optimize all images in Media library – Start Optimizing.
Here you can also optimize all other images outside Media library such as graphical elements of the theme and so on – Scan and optimize:

w3_cache1

wp_optimizeme3

NOTE 1: The optimization procedure requires considerable resources so hitting the CPU resource limit temporarily is probable.

NOTE 2: The plugin allows determining a degree of image compression. For example, if you own a photo blog, note that well-compressed pictures will lose quality.

You can also set the plugin to conduct scheduled optimization in Advanced Settings. Scheduled optimization does not include Media Library images, because they are either already optimized or will be optimized on upload.

Compressing files

cPanel includes the Optimize Website function. It uses Apache’s mod_deflate to compress content before sending it to the visitor’s browser:

site_optimize

site_optimize1

Select Compress all content and click on Update Settings.

Using browser cache

The Expires header is a way to specify a period of storing/keeping/caching the static contet of the website (CSS, Javascript, images, etc.) in the visitors’ browsers. This will significantly cut down the website load time for your regular visitors. Just copy and paste the following code in your root .htaccess file to optimize WordPress site:

ExpiresActive on

ExpiresByType image/jpg "access plus 60 days"
ExpiresByType image/png "access plus 60 days"
ExpiresByType image/gif "access plus 60 days"
ExpiresByType image/jpeg "access plus 60 days"

ExpiresByType text/css "access plus 2 weeks"
ExpiresByType image/x-icon "access plus 2 weeks"

ExpiresByType application/pdf "access plus 1 month"
ExpiresByType audio/x-wav "access plus 1 month"
ExpiresByType audio/mpeg "access plus 1 month"
ExpiresByType video/mpeg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/quicktime "access plus 1 month"
ExpiresByType video/x-ms-wmv "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"

ExpiresByType text/javascript "access plus 2 weeks"
ExpiresByType application/x-javascript "access plus 2 weeks"
ExpiresByType application/javascript "access plus 2 weeks"

The values can be changed according to your specific requirements.

Using caching plugins

A number of WP caching plugins are in use, and the vast majority of them drastically improve the page load time. W3 Total Cache and WP Super Cache are the most popular ones. The main difference between them is that W3 Total Cache is more customizable.

Below are the guidelines for its initial setup and tweaking that help to optimize WordPress site..

To configure the plugin, go to Plugins > Installed Plugins > find W3 Total Cache > Settings:

w3_cache2

NOTE: If you are a shared hosting account user, remember that all available caches should not be enabled at the same time – avoid choosing Toggle all caching types on or off (at once). The reason for this is that if Object caching and Database caching are on, they will trigger resource usage spike without any improvement of the page speed. These caches can be enabled if your WordPress website is hosted on a VPS or Dedicated server only.

Scroll down the page and check Enable next to the following options:

1. Page Cache
2. Minify
3. Browser Cache

Then click on the Save All Settings button.

Below you can find some additional measures which do not have effect on the page speed but may improve resource usage and user experience.

Homepage optimization

The first thing people see on the website is the homepage. It is very important to pay attention to its proper optimization:

1. Do not overload the page with widgets, e.g., social media sharing buttons. They are needed only in blog posts.
2. It is better to display excerpts on the homepage, not full posts.
3. Homepage should not show too many posts, five is fine.

Setting up LazyLoad

LazyLoad suggests loading only the images which are visible in the visitor’s browser window at the moment. When the reader scrolls down, the other images begin to load, just before they come into view. An example of such plugin is jQuery Image Lazy Load.

Though this measure doesn’t have a visible effect on the page speed, it can make the website consume fewer resources by loading less data for users who don’t scroll your pages all the way down.

Enabling hotlink protection

If a direct link to an image hosted by you is placed on some other website, resources of your account will be consumed, as requests to fetch the image will go to your server.
Blocking such direct links is the solution. The best option is to use cPanel -> Hotlink Protection function:

cp_hotlink

cp_hotlink1

Optimizing the database

Optimizing the database may also be useful for a WordPress blog. phpMyAdmin includes the database optimization function.
Go to cPanel -> phpMyAdmin and select the corresponding database:

cp_phpadmin7

Then click on Check All so that all tables are checked:

cp_php_admin8

Then select Optimize table:

cp_php_admin9

Once this is done, you should see the following output:

cp_php_admin10

Also, we recommend trying specialized plugins such as WP-DB Manager which are intended for similar purposes.

We would also like to remind you to back up the database before making any major adjustments especially with third-party plugins.

That’s it!

LEAVE A REPLY

Please enter your comment!
Please enter your name here