WordPress is one of the most popular content management systems (CMS) in the world and it’s used to power millions of websites, including some famous websites such as BBC America, The New Yorker, Variety, and MTV News.
Page loading speed is important because it can affect the user’s experience on your website and your SEO score. Google uses page speed as part of its ranking algorithm, so it’s important to ensure that your website loads as fast as possible.
There are many things you can do to keep your website running fast. Follow the 11 tips in this article and your website will be running faster than ever before.
1. Quality Hosting
Make sure you do research on hosting providers, and find a provider and plan that works well for you. Smaller WordPress blogs can use shared hosting plans, but if your blog is your business or it gets a lot of traffic, you might want to consider a VPS, dedicated, or cloud hosting plan.
Some providers offer hosting specifically for WordPress, and their servers have been fully optimized to help WordPress run as fast as possible.
Hosting is the most important aspect when it comes to page speed, so it’s important that you do your research and find the hosting plan and provider that are suitable to your individual requirements.
2. Choose a lightweight theme
Choosing the right theme is important when considering loading times. There are many free and premium WordPress themes available, and your choice of theme will hugely affect the page load speeds.
In most cases, you’ll find that premium WordPress themes are better than free themes because they come with more customization options, offer better support, and are usually coded by professionals.
3. Optimize images
Websites with lots of images will take longer to load because images tend to be quite large. The larger the file size, the longer it takes the visitor to download and view the page.
You don’t necessarily need to reduce the number of images on your website. Instead, you can optimize them so they load as fast as possible.
The first thing you want to do is edit the size of the image so it’s exactly the size you require for your website. If you need an image which is 400 pixels by 400 pixels, you should edit your image to be that size before uploading it to your website. HTML or CSS only reduces the viewable size of an image and doesn’t reduce the file size and loading times. So don’t use a 12 MP image, when you only need a small image. This will save the visitor having to download many megabytes of unnecessary data.
Once you have your image in the correct size, you’ll need to save it so that it is ready for the web. If you’re using Photoshop, then you can use the “Save for Web” option. You should now have an image which is the correct size and a file that is as small as possible.
Finally, you can use compression techniques to get the file even smaller. Use a free service such as TinyPNG, which will use smart lossy compression to reduce the size of Jpegs and PNG files. It’s possible to have a full HD image, with excellent image quality for less than 200 kb if you follow the methods described above.
4. Use a caching plugin
WordPress uses PHP to make database queries in order to bring up content which your visitor sees. This adds time to the loading process and means that pages are rendered more slowly. Caching plugins dynamically generate HTML files and serves them to your visitors instead. This means files are served from previously generated data, which loads much faster.
There are many free and premium caching plugins available to download, but the two most popular ones are W3 Total Cache and WP Super Cache.
W3 Total Cache has a large learning curve and is highly configurable. On the other hand, WP Super Cache is easy to use and less configurable, but it is also less powerful than W3 Total Cache.
5. Use a Content Delivery Network (CDN)
CDNs can significantly speed up websites because files are hosted on various servers around the world. When the server is closer to the end user, websites will load faster as the server response time will be reduced.
There are many CDNs available, both free and paid. CloudFlare has both free and premium options for its CDN. The free option limits you to only one website and you also don’t get access to all the pro features. But the free option is good enough more most users. As your website becomes more popular and drives more traffic, you might want to consider upgrading to a paid plan.
CloudFlare can also be connected to caching plugins and can help take the strain off your own server by loading images and other media files from a network of servers in various places around the world. When a user visits your website, they are served with files located on the nearest server.
6. Remove unused items
Just like an operating system, WordPress can slowly start to clog up and slow down. Delete trashed or unused pages and posts, remove themes and plugins that are not in use, and delete any media that you aren’t using. Also remove any post revisions that you no longer require. This will help to reduce the database size and the number of files saved on your server.
When you uninstall a plugin, the database entries for that plugin aren’t always removed with it. So, if you reinstall a plugin, you can get all your data back and everything will be the same as it was before you uninstalled the plugin.
However, if you’re not planning on using a particular plugin again, you can safely remove the tables in your database connected to that plugin.
There are two options for cleaning your database. You can do it manually by logging into phpMyAdmin, locating the relevant tables, and removing them. Alternatively, you can use a plugin such as WP-Optimize which will clean up your database tables.
The problem with using a plugin is that you have less control over what is being removed, but it is significantly easier to use if you don’t know phpMyAdmin.
7. Prevent hot linking & leeching
Hot linking is where other people steal your bandwidth by directly linking to images on your website. This means that when they get a user to their website, your server will load the images which the user sees on their website.
To stop this, you will need to put some code in your .htaccess file.
You will need to replace example.com with the name of your domain.
8. Set expires headers
By setting Expires Headers to your static content, you can significantly speed up page loading times for returning visitors. After a person has visited your website, their browser will store website content in temporary files. The next time that visitor comes to your website, these files can then be loaded directly from the visitor’s computer resulting in much faster loading times as the files don’t need to be downloaded. Expires Headers will tell the browser how long to keep that data before downloading it again.
W3 Total Cache allows you to set Expires Headers or there are other plugins available which can do this for you. Alternatively, you can just put some code in the root .htaccess file.
GTMetrix (gtmetrix.com/add-expires-headers.html) provides the following code to achieve this:
Here you can change the length of time for each file type according to the requirements of your website. If something is rarely updated, then you can set a longer time. Files which are regularly updated shouldn’t have Expires Headers.
9. Lazy Load Media
To speed up the loading time for the end user you can use Lazy Load. This only loads images toward the bottom of the page as the user scrolls down the page. Therefore, as the user visits your website, images that they can see at the top of the page are loaded first. The lower images are then loaded as the visitor scrolls down.
10. Turn off Trackbacks & Pingbacks
When you post content on your website, WordPress attempts to contact other blogs to notify them that you have linked to their website. The same happens when they publish content on their WordPress website which links back to your website. This causes a lot of extra and unnecessary work for your server and can safely be turned off.
This won’t affect your SEO score or the number of backlinks you have, and it can help to speed up your website by reducing the server load.
11. Use static HTML
Static HTML loads much faster than PHP and if you know how to read and edit PHP, as well as write HTML code, then you can improve site speed even more.
Your website will have elements which are exactly the same on all pages. This usually includes header.php and footer.php, as the header and footer sections are the same on all pages.
For example, in most themes, the <title> tags in the <head> section would use PHP to retrieve the name of the website from the database. It does this because when you change your website title, WordPress will automatically update your <title> tags. If you’re not planning on changing the name, you can remove the PHP code from the <title> tags and manually enter the name of your blog.
Similarly, you’ll find other instances of PHP that can easily be changed to static HTML. This can include things such as copyright notices, menus, website names, and more. By changing all of this PHP to static HTML, you can reduce the number of database requests being made during the loading process and speed up the website.
Page speed is important, and faster loading times help to improve the user experience, reduce bounce rate, and improve your SEO score. Therefore, keeping your WordPress installation running as fast as possible is vital to the success of your website.
Fortunately, WordPress is such a versatile CMS, that you can just make a few changes and install a few plugins to significantly improve the page load times.