All you need to know about tweaking and optimizing WordPress - the world’s most popular Content Management System (CMS)

Here’s a preview of what we’ll cover:

So, let’s get started!

Why WordPress Speed Matters

You don’t need to read million-dollar research papers to convince you of one simple fact about a website that you’re visiting: If it’s too slow – you’ll go (…as far away from it as you can)! If that’s how you react to slow sites, why won’t you believe that your visitors will react the same way to your slow WordPress site?
But in case it does take extensive and credible research to convince you of the pitfalls of slow websites, here are some eye-popping stats based on website performance of one of the world’s leading retailers – Walmart:

  • 1-second of website performance improvement increased conversion rates by nearly 2%
  • 100-MS of performance improvement saw revenues grow by 1%

If your WordPress site is slow, you’re not only losing out on traffic (which is an SEO imperative), but you’re also losing potential revenue. But what’s worse still is the fact that, very likely, your competitors with faster-loading and better performing websites are benefiting from your poor-performing site!
So, what are you going to do about it?

WordPress Speed-Enhancing Tips

Here are a few things that any WordPress site owner can do immediately, to enhance the performance of their sites.


1. Choose WordPress Hosting Wisely

One of the biggest drags on your WordPress site can come, not from your doings but, from your choice of a hosting service provider. We’ll talk about speed-enhancing hosting options in a second but, whatever you do, choose your web-hosting service wisely. Don’t just choose the first low-cost provider you come across. You’ll regret it in the long-run!


Typically, you could choose a Shared hosting service, where you share resources with other sites on their servers. The challenge here is that shared traffic can drag host server performance, which might slow down your WordPress site. One hosting provider that is the exception to this is Bluehost.


Your other choice is to use a Managed WordPress host, such as WP-Engine. With exceptionally fast load times, and practically no downtime, your site will not only always be available to visitors and customers, but it will be fast as well! And, from my personal experience, should you need online support, WP-Engine staff are always available.


If you are slightly more tech-savvy, you may want to try DigitalOcean VPS hosting. Based on my experience, this is probably the best WordPress hosting option to use, with unbelievably fast speed and unrivalled client support. For sites with 25,000+ visitors a month, a Virtual Private Server-hosted solution might be the better way to go, as opposed to Shared Hosting.

2.Optimize WordPress Homepages

Since your Homepage is what will give visitors their first impression of your site, it’s important to begin your WP speed-up process there. Here are a few things you can do to get started:

  • Set-up WordPress to only show content excerpts (“Summary”) by default, instead of the entire article (“Full Text”)
    Show Wordpress Summary Instead of Full Text
    (Source: https://make.wordpress.org/support/user-manual/wordpress-settings/reading-settings/
  • Reduce the number of posts displayed per page
    Reduce number of posts displayed per page
  • Reduce the number of comments displayed on each page (“Break comments into pages…”)
  • Let WordPress automatically clear comments after a certain interval (“Automatically close comments older than…”)
  • Remove unnecessary, older or inactive widgets and plugins from your Homepage

You’ll be amazed how these simple WordPress configuration settings can dramatically speed up Homepage load times.


3. WP Image Optimization

According to Google, over 62% of the weight of your webpages come from images. And that means images have a lot to contribute to the speed of your site. In fact, in Google’s own words “If you can, get rid of images!” – But how good would a WordPress site look without images? So, what’s the next best thing to do? Optimize images for your WordPress site!

 Types of Web Content Pie Chart
(Source: https://developers.google.com/web/fundamentals/design-and-ux/responsive/content)


If you run an image-heavy WordPress website, pictures, graphics and other images can create huge speed drags and impact load times. You can, if you are handy enough, use an image editor (like Photoshop) to optimize the quality of your WordPress site images. However, the easier way to speed-up your site is to optimize your images using WP-SmushIt, WordPress’s free image-file compression plug-in.
Not only is it free, but it also doesn’t impact the quality of your images – so why not make use of it to speed-up your site?

4. Caching Plugins

If your WordPress site isn’t serving up cached pages, then your site will constantly be making “page requests” on the server, which will drastically slow-down your entire site. What’s the solution? Use a good caching plugin to help enhance page load-times.
W3 Total Cache is one of my personal favorite caching plugins. Not only does it have all the WordPress cache-management features you’ll need, but it’s amazingly easy to get started – AND…it’s FREE!

5. Speed-charging WordPress With CDNs

If your WordPress site serves visitors and clients from across a broad geographic area, the further away (from the physical proximity of your web server) that you traffic comes from, the more pronounced will be the speed degradation they experience. The fix? Use a Content Distribution Network (CDN) to enable your WordPress sites’ content to be accessed from multiple servers across the globe.


 Cloudflare CDN Network
(Source: https://www.cloudflare.com)


With over 151 data centers through which to serve your site content to visitors, my personal favorite CDN is CloudFlare, which offers you:

  • Performance improvement
  • Integrated security against a host of online threats, including DDoS Attacks, Hacking, Data Theft, Malicious BOTs…and a whole lot more!
  • Reliability that powers over 7 million websites globally
  • Powerful insight into traffic, both human and BOTS, on your site

It not only works great with W3 Total Cache (the cache plugin discussed earlier), but like W3 Total Cache, CloudFlare has a free offering too!

Not sure how to set up Cloudflare? Check out our step by step guide to setting up cloudflare.

6. Use Faster Gallery Plugins

If your WordPress site relies on a large collection of pictures, photographs and images, you’ll probably want to create an image gallery on your site. WordPress has a built-in image gallery feature that allows you to create and manage your images across the site. However, the default plug-in can sometimes expose your site to speed degradation.

 

Wordpress Gallery Plugins
(Source: https://codex.wordpress.org/The_WordPress_Gallery)


The best way to avoid such issues and, while you’re at it, to add some speed to your site, is to use a faster gallery plugin. My personal favorite in this space is Envira Gallery. Not only does Envira offer a more user-friendly way to plan, manage and organize your WordPress galleries, but it also maintains the quality of your images, while helping to boost the speed of your site by over twice that offered by other gallery plug-ins available.

Tips for The Technically Inclined

If you are a bit more technically-inclined, you might want to try these additional tips to speed-up your WordPress sites:

7.Prevent Hotlinking and Leeching of Content from Your Site

Where there’s high-quality image content (on your site!), there’s leeching and poaching by other site owners! They do this by using your URLS to place your images onto their site. Cruel…but effective – for them! Not only does this degrade your WordPress site speed, but it also results in stolen bandwidth (for which you’re paying!) and lost traffic for your site.
So, is there something that you can do about it? Yes, there is!
To prevent hotlinking and leeching of content from your site, you could modify your hypertext access file. If you don’t have one created, you can do so through Settings > Permalinks on your WordPress Dashboard:
 Permalink Settings

  • Open up your .htaccess file
  • Add the following lines of code to the file:

    #disable hotlinking of images with forbidden or custom image option
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain [NC]
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
    RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]

    Remember, you’ll need to replace “yourdomain” with your own domain’s URL.
  • Close/Save the file

8. Restrict Post Revisions


WordPress maintains a copy of all page revisions or revised posts, making its database rather “bulky”. This then acts as a barrier to site speed. One way to ensure your post revisions don’t hinder your site speed, is to limit the number of revisions that WordPress keeps in its database.
To do this, simply open your wp-config.php file, and add the following line of code to it:
define( 'WP_POST_REVISIONS', 4 );
You may replace “4” with the number of revisions you wish. WordPress will then restrict revisions to that number, and will delete all other iterations of revisions automatically.

9. Optimize your CSS and JavaScript files

Another important WordPress speed-booster lies in the efficiency of your CSS and JavaScript code. By optimizing (or “minifying”) your code, you’ll be able to inject additional speed into your site. What minification does is to strip out redundant or unnecessary code (features like empty new lines, comments, extra spaces etc.) that drag down your page load times.
Online tools, like CSSMinifier do a great job at optimizing your code. However, if you are using free WordPress plugins like W3 Total Cache, it too has features to help you minify JS and CSS files.

10. Choose HTML over PHP

By default, WordPress uses PHP, and an associated database, to dynamically load critically-needed data elements about your site, and then uses that data to manage site operations, and to display pages and images accordingly. All of this interaction, between the database and WordPress, adds to load time and decreases site speed.
One way to get around this issue is to replace all (or most) of your dynamic PHP code with static HTML code, which will provide you some (albeit not too much!) speed improvement. Since HTML doesn’t need to interact much with the database to fetch the required data, it is faster (than PHP). Besides, HTML code is much easier to understand and maintain too!

11. Database Optimization

If you have been operating your site for a while now, chances are that your WordPress database has accumulated a lot of redundant information/data over time, including unwanted Meta data, old/outdated comments, comments from spammers, revised posts etc. All of this undesired baggage not only adds time when performing site backups, but it also drags down site speed.
 

 

optimize wordpress database

 


One way to enhance site speed is to use the WP-Optimize plugin at regular intervals. The configuration settings for WP-Optimizer allows you to select a whole range of optimization characteristics, and then provides you a one-click option to proceed with optimizing your database by applying the rules you selected. You may also use other tools, like WP-DBManager to repair, compress and optimize your databases.