SEO WordPress

How To Optimize WordPress and Improve Speed

Are you looking to Optimize WordPress and improve the overall load time of your website? It is a known fact that many search engine algorithms consider your website speed while calculating page-rank. Not only is improving your website speed good for SEO, it’s also critical for improving visitor click-through rate and user satisfaction.

GTMetrix (https://gtmetrix.com/) has a great tool for checking your website’s load time remotely, and displaying details on which elements are causing the slowdown with a waterfall and YSlow score.  Most modern browsers like Chrome and Safari also have this feature in the Developer menu.

Many reports claim a website that takes longer than 2 seconds to load will result in up to 7% less readers and lost revenue, and exponential worse beyond that. Your website visitors do not want to wait for a website to load and that means you’ll be losing potential customers too! Consider the following important elements of speeding up your WordPress website:

Choosing WordPress Web Hosting

The first step, and one of the most obvious ways to improve the speed of your website, is choosing a reputable web host that supports WordPress and provides full support including optimization.

Not only does a great web host prevent your website from being offline at critical times, but also offers top-notch support and a stable hosting account with dedicated resources. (Consider choosing a web host which specifically lists exactly how much CPU, RAM, and other resources are available to your individual hosting account).

At HostUpon we have Optimized WordPress Hosting Plans you can check out.  Our plans are made specifically for WordPress users who need reliable and affordable WordPress hosting.  We’ve even partnered with CloudFlare to provide free CDN services for all customers!

Choosing the right WordPress theme / framework

Many WordPress themes or frameworks have far more features that you may need. Consider starting with a solid foundation such as the default WordPress theme which is lightweight and very fast. Some “premium” themes are loaded with plugins and low-quality customizations which immediately slow down your website upon activation.

WooThemes’ Canvas theme is the perfect premium framework for many different types of websites, is highly customizable, and surpasses the basic features included with the default WordPress themes.

For the absolute best performance, avoid themes which include a Visual Composer or layout builder which often slows down the admin dashboard and other elements of your site.

If you’re looking for a WordPress theme be sure to check out ThemeForest.  They have thousands of themes from a community of developers.  It’s an amazing WordPress theme collection and almost all of the themes are designed to Optimize WordPress.

Enable Caching

Caching allows your website to store copies of individual pages as dynamic HTML files instead of loading all PHP scripts and connecting to the database for each request. Most scripts and files will load quicker because parts of it has already been downloaded which results in overall faster load times for the user.

The easiest way to enable caching in WordPress is with a plugin such as W3 Total Cache. It provides a lot of great options and configuration, while still being easy for novice users who will notice a difference as soon as they activate the caching plugin.

Use a CDN

A CDN is a network of servers dispersed across the world. Each node caches static content on your website such as images, CSS, Javascript, and other components and delivers it from the server in the same geographic region as your website visitor.

Because the majority of an end-user’s page load time is spent downloading background files and dependencies, a CDN with many “edge servers” can ensure a consistent user experience across the world, in terms of speed.

A CDN is easy to implement, once you decided which files (typically static resources) it needs to mirror. You would configure your website to send requests of those files to the CDN, which takes care of load-balancing and geo-locating your visitor. There are also many WordPress plugins available for connecting your website to a CDN. (Note: Most CDNs available are a third-party paid service ranging from $9/month to $20/m to get started).

Check out this simplified explanation from GTMetrix:

optimize wordpress with CDN

Will a CDN speed up every website, and do you really need one? No, it is not necessary and ultimately, for some users, the added cost is not worth the benefits gained. This is particularly true when all of your website visitors are in the same region, or even the same country. One centralized server with a high speed connection to your area is likely going to deliver your website to visitors without any delay.  CDNs are typically recommended for large-scale websites with thousands of users spread across multiple continents.  A CDN is the simplest way to optimize WordPress without any technical skill or major changes to your website code.

Optimize Images and Static Content

Images are often some of the last elements to load on a webpage, and if they’re large file sizes, the user will have to wait for them to download. Most images uploaded to your website should be scaled down to the minimum resolution and smallest file size possible.

The easiest way to optimize images in bulk, without sacrificing quality, would be to use a CMS plugin (such as WP Smush for WordPress, which optimizes images as you upload them), or a website like TinyPNG (which, despite the name, supports both JPG and PNG files). Tiny PNG has a drag-and-drop interface to shrink up to 20 images at once, and also lists the total file size saved.

Optimize the MySQL Database

You should consider installing a plugin such as WP-Optimize or WP-DB Manager to optimize your MySQL database by removing unnecessary records, clearing out post revisions, spam comments, and reducing the overhead on each request.

This can also be done manually but it’s highly recommended to use a plugin that will run an initial cleanup, or even scheduled recurring optimizations.

Disable Hotlinking

Hotlinking occurs when other sites have a direct link to a resource on your website which will directly affect the resource usage of your server / hosting account. As more and more people link to content (such as images) on your website, eventually your entire server resource allocations will be used up and your own website will become extremely slow.

To stop this, place the following code into your .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)example.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|php|png|css|pdf)$ - [F]\

And replace example.com with your own domain.

Only load images the user needs

Your website load-time could be delayed because all of the page’s images are downloading. With a plugin such as Image LazyLoad, your website will only download images above the fold (within the user’s view) and the rest as the user scrolls down the page.

This type of optimization is not best for all websites – especially those which a user would need to see or have access to the entire page right away. Also, with image optimization from step #5, enabling lazy loading won’t be necessary for most static websites.

Replace PHP

Converting your PHP to static HTML can be a bit advanced for the average WordPress user however it can contribute to lowering the load on your CPU, processing time, which will ultimately speed up your website requests.

For one example, the typical header.php file which links all of your stylesheets, titles, and page information is often a PHP file that contains at least 5 executions. This is run every single time your webpage is loaded. If you’re familiar with PHP, you can convert yours to one static HTML file.

General Optimization Tips

Here’s a few more quick tips to keep in mind for improving the overall speed and optimize WordPress:

  • Display excerpts instead of full posts and reduce the number of posts per page
  • Remove unnecessary widgets from your sidebar (plugins and widgets are often a huge factor when it comes to speeding up your website).
  • Remove inactive plugins and plugins that you don’t really need, or that can be replaced
  • Remove dynamic content, Flash, and resources hosted on a remote server
  • Control the amount of post revisions / drafts stored by WordPress after you’ve published.
  • Turn off pingbacks & trackbacks
  • Keep WordPress, your theme, and all plugins up to date! Also consider reading release notes for new updates to ensure compatibility with your theme and other plugins. Outdated or incompatible plugins can be one of the top causes of a sluggish WordPress website!
  • Combine all CSS files into one single file and all Javascript files into one single file

Add comment