467,908 Members | 1,851 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Share your developer knowledge by writing an article on Bytes.

How to Speed Up the WordPress Website

Suppose if the house is sinking one does not polish the Windows but the foundation is fixed. Same applies for a website as well. If the website is hosted on a bad server or is not having a bad server the quick fixes of the website will not help. A person will be required to fix the foundation.

Hence let's start with what makes the good foundation for the website and to set up the website which runs at a lightening speed.

Choosing a Good Web Host

A web hosting company and the hosting package you choose can have a great impact on the speed of the website. One should always remember that hosting is not an area which one can neglect.

The DNS response time is an important perspective which one should check while choosing the hosting service. The clients who use cheap hosting services can have a DNS response time of 250 seconds while we provide a server response time 30 milliseconds.

Choosing a Good Theme for the Website

One should remember that not all the WordPress themes are created equally. There are some which are extremely fast as well as well coded while the others are too complex and bad.

There are many examples which have showed that changing just the theme has improved the speed of the website from 630 to 172 miliseconds.

When a theme is chosen one should check the page speed of the theme demo by using the tool such as Pingdom. This will give you an idea of how well coded the website is.

By Using the Content Delivery Network

There are examples which has stated that usage of content delivery network for the website have noticed a reduction in the bandwidth usage as improves the page loading time of a website to a great extent.

The CDN helps in hosting the website files across a huge network of the servers around the world. Hence if a website on CDN is visited by someone in Africa then the files will be downloaded from the server which is closest to them. Setting up the server can take few hours, but it is one of the quickest ways by which the page loading time can be improved.

Quickly fixing the Speed of the WordPress Website

Once a person has made a strong foundation then they can start with the fine tuning of the website. The best way of starting to speed up the website is to check what are the things that can be removed. Most often a website speed is slow not because of what it is lacking but majorly because what it is having.

Identifying the Plugins that Slows Down the Website

One of the biggest culprits is the social-sharing plugins, which slows down the website most of the time. In most cases the loading time can be decreased by embedding the social buttons in the theme source code. Once a person is aware of which is the plugin which is slowing down the website you will be able to make an informed decision on if you want to keep it, replace it or remove it entirely.

Compressing the Website

When the file is compressed as a zip file on the computer, the total size of the file is reduced, hence making it much easier as well as faster of sending it to anyone. Here the Gzip will be working in exactly the same way with the Web page files.

Once it has been installed the Gzip will be automatically compressing the website files as the ZIP files, which will save the bandwidth and speeding up of the page loading time. When the visitor is using the website the browser will automatically be able to unzip the files and show the contents. This type of transmitting the content from the server to the browser will be more efficient and will save a lot of time.

As such there is no negative effects of installing the Gzip, this can increase the speed and could be quite dramatic. Some of the plugins will be able to add the Gzip to the website with a click of a button and installation process is very simple. Here you need to open the .htaccess file and the you need to add the code as shown below

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

Once it is been added this snippet of the code to .htaccess, you need to test whether the Gzip is working on the website.

Images are the main culprits when it comes to majority of who utilizes the bandwidth. Here the compression is lossless meaning that you wont notice any kind of difference in the images. If there are thousands of images in the media library then you will be able to run it all through the plugin and then by compressing it to more manageable size.

Leveraging the Browser Caching

Browser caching can sometimes be a tricky issue. There are few good caching plugins which are available these can cause a greater harm to the website. Expires headers tells the browser if they are looking to request a particular file. This only works when the user is already having a version for the web page which is stored in the cache. This type of technique will speed up the website only for those who have already visited the website. Here the expires headers will speed up the website in two ways. The user needs to reduce the need of returning visitors in downloading the same files from the server twice. Secondly this reduces the number of HTTP requests which is made.

For using this with a plugin one can use WP Super cache. You can also add the expired headers by adding the code in .htaccess file

# associate .js with “text/javascript” type (if not present in mime.conf)
AddType text/javascript .js

# configure mod_expires
# URL: http://httpd.apache.org/docs/2.2/mod/mod_expires.html

ExpiresActive On
ExpiresDefault “access plus 1 seconds”
ExpiresByType image/x-icon “access plus 2692000 seconds”
ExpiresByType image/jpeg “access plus 2692000 seconds”
ExpiresByType image/png “access plus 2692000 seconds”
ExpiresByType image/gif “access plus 2692000 seconds”
ExpiresByType application/x-shockwave-flash “access plus 2692000 seconds”
ExpiresByType text/css “access plus 2692000 seconds”
ExpiresByType text/javascript “access plus 2692000 seconds”
ExpiresByType application/x-javascript “access plus 2692000 seconds”
ExpiresByType text/html “access plus 600 seconds”
ExpiresByType application/xhtml+xml “access plus 600 seconds”

# configure mod_headers
# URL: http://httpd.apache.org/docs/2.2/mod/mod_headers.html

Header set Cache-Control “max-age=2692000, public”

Header set Cache-Control “max-age=600, private, must-revalidate”

Header unset ETag
Header unset Last-Modified

Cleaning up of Database

Often times the WordPress autosaves everything but the main advantage is that the database will get filled with thousands of post revisions, trackbacks, pingbacks, unapproved comments and trashed pretty qucikly.

One can clean up the database using plugin called WP-Optimize, here it will routinely clear the database trash, which keeps the database efficient as well as filled only with what is required. Hence when doing with the database one should always back it up.

Minifying the CSS and JavaScript Files

If there are more than a handful of plugins that have been installed, then there are chances that website will link to 10 to 20 individual style sheets and JavaScript files on each page. Hence putting all the JavaScript into one JavaScript file and all CSS in one SCC file is very important as well. This is the situation when the minification comes in where the Plugins will combine all of the style sheets and JavaScript files into one. This will reduce the number of requests which the browser will require. One can use better WordPress minify as it is less aggressive than other plugins for doing the same thing.

Turning Off the PingBacks and the TrackBacks

Pingbacks and Trackbacks are the methods which is used by the WordPress for alerting other blogs than other links too. While something interesting, this can be a drain on the page speed and are usually better when turned off. This can be turned off uder the “Discussion” tab in the “Settings” section.

Specifying the Image Dimension and the character Sets

Once before a visitor browser is able to display the web page. It has to lay out content which is around the images. Hence the browser has to figure it out which is the size of the image which will make it work harder as well as longer.

Here for the same reason specifying the character setting in the HTTP response header is very useful hence the browser will not have spend any time working on which you will not be using. Here you just need to add the character set to the websites head section.

Moving the CSS at the Top of the Page and JavaScript at the Bottom

Linking to the stylesheets close to the top of the page is recommended majorly, because the browser will not be rendering the page before rendering the CSS file. Here the JavaScript on the other hand will be very close to the footer as it will prevent the browser from seperating until it has been fully loaded.

In most of the cases, this fix will help in improving the page loading speed by forcing the files so that it can be downloaded in an optimal manner. This can cause some issues on the website which is relying heavily on the JavaScript files for loading before the user is able to see any of the pages.

Using the CSS Sprite

Sprite can be called as one large image file which contains all the images which is next to each other. By using the CSS, you will be able to hide everything which is in the image except for the section you would require.

Enabling the Keep Live

An HTTP keep alive refers to the message which is sent between the clients machine and the web server which is asking for the permission to download the file. Enabling the Keep alive will allow the clients machine in downloading multiple files without need of having repeatedly asking for permission and thus saving the bandwidth.
Apr 8 '19 #1
  • viewed: 1664

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Miladin Miladinoski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.