The time it takes your website to load influences how successful it will be. If your website is slow, visitors will turn away in droves. They might even click the back button before your website loads.
Website performance will also influence your rankings in search engines. In addition to being ranked higher, many website owners report seeing an increase in search engine spider crawling after speeding up their design.
Today, I would like to share with you thirteen quick tips on how you can optimize your website and decrease page loading times. If you follow these techniques and best practices, your website will load much quicker.
Before applying these techniques to your website, I encourage you to check the speed of your website using a free performance service such as GTMetrix, YSlow or Google PageSpeed Insights. These services will inform you of your page loading time and the overall file size of your page. They also offer tips
1. Choose the Right Hosting Plan
The first step in optimizing your website correctly is to choose the right hosting plan. You are fighting a losing battle if your server is taking an age to process HTTP requests and MySQL commands.
Performance services such as GTMetrix will advise you of the exact response time of your server. I recommend testing the response time of your own website against similar websites. For example, if you run a photography blog, see how your server response time compares to other photography blogs within your niche.
Hosting companies are not always the cause. You may be with a great hosting company but see poor response times because your chosen hosting plan is underpowered. Customers using shared hosting plans, for example, are more likely to face slow loading times as hundreds of websites are hosted on the same server.
However, any type of hosting plan will suffer from insufficient RAM and CPU throttling. Therefore, you need to pay attention to what your website needs to run smoothly. Do not be a cheapskate and go for the cheapest option. Choose a hosting plan that can handle traffic spikes efficiently.
2. Use a Fast WordPress Theme
A design that has been coded badly, or uses images throughout the design, will add unnecessary weight to your page. It is not uncommon for some WordPress themes to be a few megabytes in size. Such a design could add a few seconds to your page loading time.
Choose a design that has been optimized for desktops, tablets and mobile devices. Search engines favor responsive designs as they ensure all pages have the same URL, however adaptive designs that were created specifically for mobile phones can improve a mobile user’s experience considerably (it is not uncommon for an adaptive design to reduce page size by over one megabyte).
Unfortunately, most theme developers optimize their theme demo website using caching and content delivery networks. This makes is difficult to know how quick a WordPress design is before using it yourself.
3. Monitor Your Plugins
Before you install any plugin on your website, ask yourself “Is this plugin necessary?”.
Plugins are one of the biggest causes of WordPress websites being slow. The more plugins you install without research, the more likely you will face performance issues; however the sheer number of plugins you have installed is not the reason a WordPress website can slow down.
Certain plugins are known for causing websites to be slow. There are many reasons for this including bad coding, calls to external servers and persistent calls and updating of your WordPress database. Pay close attention to how much CPU plugins use too. Many plugins can bottleneck your CPU due to persistent processes. If this happens, your whole server could go down.
One plugin I highly recommend you use is P3 Profiler. Developed by GoDaddy, the plugin will show you exactly how much load time your plugins are adding. A breakdown is given which displays exactly how much load each plugin adds. It is the most effective way of seeing what plugins are slowing down your website.
4. Empty Your Trash
WordPress 2.9 introduced the WordPress trash system. Whenever content is deleted, be it a comment, post, page, media etc; it is sent to trash. From here, the content can either be restored or deleted permanently. It is effectively a fail-safe system that helps you recover anything that was deleted accidentally (in much the same way the recycling bin works in your computer).
Trash can take up a lot of unnecessary room in your website’s database. The bigger the database, the longer it is to retrieve information from it.
By default, WordPress will automatically delete trash after thirty days. This can be reduced by modifying the wp-config.php file. For example, you could reduce this to seven days by adding the following:
define ('EMPTY_TRASH_DAYS', 7);
You can completely disable the trash system by adding this to your wp-config.php file.
define ('EMPTY_TRASH_DAYS', 0);
5. Reduce Post Revisions, Drafts, Spam, Pingbacks and Trackbacks
It is not just trash that can needlessly increase the size of your database. All post types populate table rows with data. Therefore, it is important to regularly delete spam comments and unwanted pingbacks and trackbacks.
You should also be wary of the number of drafts and post revisions your website has stored. The WordPress revision system allows you to go back to older versions of articles, view them and restore them.
In addition to one autosave of your posts and pages, revisions will be generated each time you save your articles. This means that an article with ten revisions with take up ten times as much room on your database than the actual article that was published. As you can imagine, this increases the size of your database considerably.
By default, WordPress will save an unlimited number of revisions, however this is generally not needed. It is better to reduce this limit to something more practical such as two or three. You can do this by adding the following code to your wp-config.php file:
define( 'WP_POST_REVISIONS', 3 );
Alternatively, you can completely disable the post revision system by adding the code below to your wp-config.php file. From a blogger’s perspective, this is not an optimal set up as post revisions are very useful, however many website owners have taken this step to ensure their database runs more efficiently.
define( 'WP_POST_REVISIONS', false );
A more practical way of cleaning your WordPress database is to use WP Optimize. The plugin can automatically remove auto-drafts, spam comments, trackbacks and more. WP-DBManager is also a good solution for optimizing your database.
6. Optimize Your Images for the Web
Images can help break up long pieces of text and can help your articles be shared more frequently on social media services; however they also take up a lot of storage. Therefore, pages that contain many images can take a long time to load.
It is therefore in your best interests to optimise your images for the internet before you upload them to your website. Most photo editing applications, such as Photoshop, allow you to do this via the “Save for Web” option.
A good plugin to optimize images that have already been uploaded is WP Smush.it. It utitlizes the Smush.it API to optimize JPEG images, strip meta data from JPEGs and convert GIF images to PNG. You should however be aware that the plugin uses up a lot of resources when it is converting images, therefore your website may be slow whilst it is running.
If you do not want to sacrifice image quality, check out Lazy Load. The plugin ensures that images are only loaded when the area becomes visible to the user. This will greatly reduce page loading times.
7. Choose Your Advertisements Wisely
Be conscious about the type of advertisements you add to your website. The most efficient way of promoting a product or service on your website (from a website performance perspective) is to link directly to the page using an image that has been optimized for the web. You can take this one step further and link using text links instead.
Adding advertisements from third-party advertising networks can increase loading times due to the calls that are made to external servers. Even localised ad tracking scripts can hurt performance. For example, the popular ad rotation plugin OIO publisher has a bad reputation for increasing page loading times.
Of course, advertisements are necessary for most websites to survive, therefore you need to strive for the right balance between speed and income. If you optimize all other areas of your website design, a few advertisements will not be too damaging. Just be sure you are fully aware of what load each advertisement adds to your website by testing your website speed before and after adding the advertisement.
8. Consider Not Using Official Social Media Buttons & Widgets
For most website owners, social media traffic is second only to search engine traffic. Which is why social media sharing buttons are so prominent on website designs.
Official sharing buttons are popular as they denote the number of shares a page has had. Unfortunately, official sharing buttons from services such as Facebook and Twitter can increase loading times immensely due to the calls they make to external services. I previously displayed sharing buttons above and below articles for Facebook, Google+ and Twitter. This added a whopping 500KB to my pages.
By simply changing to text links or locally stored social media images, you could save reduce your page size by up to one megabyte.
9. Enable Gzip Compression
Gzip compression allows a website page to be transferred to a browser at up to 70% of its original size. The browser will then decompress the page and display it to the user.
Gzip can be enabled via the WordPress options page. You can find this page at www.yourwebsite.com/wp-admin/options.php. To enable Gzip, simply change the value of the Gzip field from 0 to 1.
11. Enable Browser Caching
Browser caching allows internet users to speed up the loading time of their favourite websites by storing a cached copy of your website locally. This reduces calls to your server and saves the user from downloading the same files again.
You can enable browser caching by adding the following code to your .htaccess file:
The code above specifies how long a particular file type should be stored. Files will simply be downloaded again if they have expired.
12. Install a Cache Plugin
Caching plugins allow you to publish static HTML files instead of dynamic files. This greatly reduces the time a page takes to load as there are no PHP or MySQL commands to execute.
Additional caching features include minification, caching of feeds, Gzipping, Content Delivery Network (CDN) support, and much more.
Caching your pages is one of the most effective ways of improving your page loading times, with many plugins promising an improvement of at least ten times. Popular caching plugins include WP Super Cache, W3 Total Cache and WP Fastest Cache. All three plugins are available free.
13. Use a Content Delivery Network
Your website is hosted in a data center somewhere in the world. The further a visitor is from the location of your data center, the longer it takes for your web pages to load.
Popular content delivery networks include MaxCDN, Amazon CloudFront and CloudFlare. The cost of these services vary according to how much bandwidth your website uses. For example, MaxCDN’s cheapest plan costs $9 per month for 100GB of bandwidth.
Optimizing your website is no longer an option. With search engines placing so much importance on the speed of web pages, it is vital to your website’s success to have fast loading web pages.
A lot of people wrongly assume that you need to be an expert to optimize a WordPress website. Nothing could be further from the truth. 99% of optimizing your website correctly is following good practices and taking advantage of caching and content delivery networks.
I hope you have enjoyed this tutorial on optimization. If so, I encourage you to subscribe to the Carpetcleaninghaddontownship blog so that you get updated about our latest articles.