February 22, 2023
guide to WordPress speed optimization

Efficiency and speed are essential in today’s digital era.

So, you probably won’t be surprised to learn that a slow-loading page can make people stop visiting your WordPress website. If your website takes longer to load than it should, your traffic and bottom line will suffer.

As you can see, having a fast loading website is pretty important. As a result, many developers and business owners want to know how to speed up a WordPress website.

To improve your WordPress site's speed and front-end loading, you first need to test site load time to see the assets loading in the waterfall of results. You can do this by using site testing tools such as WebPageTest or GTmetrix.

Once you test your site speed, use this guide on how to speed up WordPress and make your website load faster. Fix problem areas and use these best practices to ensure you have a fast loading website.

This guide explains why quick loading times are critical and provides some useful tips for making your WordPress site faster.

To learn more, just keep reading. Or jump ahead with these links on optimizing WordPress:

Why you need a fast WordPress website

The importance of website speed cannot be understated. Your website’s visitors refuse to accept slow page loading, and can you blame them? A slow-loading website can test anyone’s patience.

If you want to keep your website visitors satisfied, your WordPress website needs consistently quick loading times. Optimizing your page load speed and performance can ensure your website is successful.

Here are the main reasons why your WordPress website’s speed is important:

  • With increased internet speeds worldwide, people have become less patient with long page loading times. Mobile users, who are accustomed to instantaneous page loading, are particularly sensitive to long loading times.
  • A positive user experience is crucial to retaining your website visitors’ interest and boosting conversion rates. User experience can be boosted by quick page loading.
  • Studies show that when a page’s loading time exceeds 2 seconds, approximately 47% of visitors leave that page. Speed up your WordPress website if you want to keep your website visitors interested.
  • In search engines such as Google, websites that load quickly are given a higher ranking than those that take longer to load. You should prioritize increasing the performance of your WordPress site if you want to boost your rankings on search engine results pages (SERPs).

Get fully managed WordPress hosting

Power your site with the industry's most optimized WordPress hosting

How to test your website’s speed

Now that you understand the importance of fast website loading, let’s evaluate your website and find out how well it’s currently operating.

On web browsers such as Google Chrome, websites you visit regularly are saved as cached files and immediately “prefetched” as soon as you begin typing a URL.

This means that if you visit your own WordPress site, it will load almost immediately. However, someone using your website for the first time may experience slower webpage loading.

You should test your website extensively and frequently to ensure your website visitors aren’t sighing while they wait for it to load. You can perform these tests using free online tools, such as WebPageTest or GTMetrix.

After performing these tests, you’re ready to learn how to speed up a WordPress site.

Before we dive in, it’s important to note that before you go about implementing the following page speed optimization tips, you’ll need to backup your WordPress site.

Any time you plan on making changes to your site that might impact site images, visual look, or site functions, then it is important to create an on-demand backup in the portal of your site.

You’ll also want to create a staging site. A staging site is the ideal environment to test site optimization changes without impacting your live site.

Disabling site assets from plugin assets on selective pages and testing out the minification of CSS and JavaScript is also ideally tested on a staging site.

Once you know that the changes you make do not break the site visually or disable a feature from working correctly, the same changes can be made to the live site.

23 tips to speed up your WordPress website

Here are some nifty tricks you can use to speed up your WebPress website.

1. Get a caching plugin

Webpages can change over time. This indicates that they are constructed as the user navigates through a webpage on your site. WordPress must perform a procedure to collect the necessary data, assemble it, and finally display it to the user when creating your webpages.

When many people view your WordPress website at once, the website will take longer to load. You can use a WordPress caching plugin to ensure speedy access to your pages. At a basic level, caching is temporary data storage for rapid access.

By default, the Object Cache Pro plugin (a commercial-grade Redis object caching plugin for WordPress) has been activated on all Nexcess sites with a valid plan since September 2022.

Redis object caching

Redis object caching is also one of the options offered by Nexcess. The Nexcess page cache is default enabled on new install sites.

Redis object caching works with full-page caching and a CDN to speed up slow queries on websites. With Redis, these queries don’t need to go through MySQL processing. Instead, the second request goes straight to Redis.

Redis object caches can be deleted by navigating to Settings > Object cache > Flush cache.

Redis object caches can be deleted by navigating to Settings > Object cache

Select flush cache to optimize your WordPress site

Flush object cache can be found directly under the Nexcess logo in the Admin toolbar.

Flush object cache in the admin toolbar

For existing sites, you are strongly advised to switch from the Redis Object Cache plugin to the Object Cache Pro plugin. Making the switch and enabling Object Cache Pro is pretty easy, and you’ll be glad you did it.

Browse caching

You should also enable browser caching. Nexcess uses NGNIX with Apache as part of the server stack. This means that you get the gains of NGNIX being used as a reverse proxy along with NGNIX micro-caching of site assets, and you can still use the .htaccess file that Apache reads.

Browser caching using expires should be set by the full-page caching plugin solution you are using. However, if not they can easily be added to the .htaccess file on the site's server.

2. Optimize your images

If you’re wondering how to make your website load faster, be sure to examine the images on your site. Large images may be to blame if your WordPress website suffers from long loading times. You can improve your website’s performance by reducing image file sizes.

The types of images you have impact front-end site size and load time. Optimizing images by bulk site optimization, as well as whenever new images are uploaded to a site, will reduce disk usage in the uploads folder on your site's server.

Optimized images will also reduce the site size and improve your site's load time. Recommended image optimization plugins with services include TinyPNG, ShortPixel Image Optimizer, and EWWW Image Optimizer. Photoshop and other image editing tools can also let you compress image files.

Here at Nexcess, we recommend our integrated Nexcess Page Cache or the W3 Total Cache plugin as full-page caching solutions. The W3 Total Cache plugin also includes minification and CDN integration features built-in, so it reduces the number of extra plugins you need to use.

3. Switch to a faster hosting provider

If you’re still experiencing slow loading, you should shop around to find the best WordPress hosting provider for your needs.

The benefits of choosing managed WordPress hosting from Nexcess include:

  • Free Object Cache Pro, along with the Nexcess page cache.
  • Excellent image compression.
  • A built-in content delivery network (CDN) to speed up websites.
  • Intelligent plugin update features, including performance monitoring.
  • No overage charges, traffic restrictions, or metered pageviews.
  • Free website migrations and a 30-day guarantee.
  • 24/7 server monitoring and help from WordPress professionals.
  • More PHP flexibility than other hosting providers.
  • WordPress-optimized servers for top performance.

4. Apply GZIP compression

GZIP lossless compression can shrink your files by up to 70%. Plus, compared with other compression techniques, it’s faster and requires less processing power.

If you use GZIP compression for your WordPress website, it will reduce your bandwidth, giving visitors faster access to web content.

Many WordPress optimization plugins allow GZIP compression. You’ll be happy to know that the process is fairly painless.

You also can manually activate GZIP compression if an Apache server hosts your website. To do so, add this code to your .htaccess file:

<IfModule mod_deflate.c>
         AddOutputFilterByType DEFLATE application/javascript
         AddOutputFilterByType DEFLATE application/rss+xml
         AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
         AddOutputFilterByType DEFLATE application/x-font
         AddOutputFilterByType DEFLATE application/x-font-opentype
         AddOutputFilterByType DEFLATE application/x-font-otf
         AddOutputFilterByType DEFLATE application/x-font-truetype
         AddOutputFilterByType DEFLATE application/x-font-ttf
         AddOutputFilterByType DEFLATE application/x-javascript
         AddOutputFilterByType DEFLATE application/xhtml+xml
         AddOutputFilterByType DEFLATE application/xml
         AddOutputFilterByType DEFLATE font/opentype
         AddOutputFilterByType DEFLATE font/otf
         AddOutputFilterByType DEFLATE font/ttf
         AddOutputFilterByType DEFLATE image/svg+xml
         AddOutputFilterByType DEFLATE image/x-icon
         AddOutputFilterByType DEFLATE text/css
         AddOutputFilterByType DEFLATE text/html
         AddOutputFilterByType DEFLATE text/javascript
         AddOutputFilterByType DEFLATE text/plain
         AddOutputFilterByType DEFLATE text/xml

This code will compress all HyperText Markup Language (HTML), Cascading Style Sheet (CSS), JavaScript, Extensible Markup Language (XML), and font files.

By default, the NGINX server software only compresses HTML files. If your server is running NGINX, open your nginx.conf file and look for the following line to apply GZIP compression to the files that make up your website:

gzip on;

Add the following code directly after that line:

gzip_vary on;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
gzip_min_length 1000;
gzip_proxied no-cache no-store private expired auth;

Then, save the file and reload your NGINX settings.

5. Use a CDN

If you have site visitors across different geographical regions, it is recommended to use a CDN. A CDN features points of presence, which are geographically distributed data centers, to ensure your website’s visitors get information from the server that is closest to them.

For example, website visitors in Europe may get data from a different point of presence than visitors in North America. This optimized proximity can increase your website’s speed.

A CDN has various advantages for WordPress website owners and visitors. By serving static assets (e.g., JavaScript and image files) from servers nearest to unique users worldwide, the Nexcess CDN conserves bandwidth and reduces server traffic.

In terms of WordPress optimization, the advantages of the Nexcess CDN include the following:

  • Enhanced user experience.
  • Increased page views.
  • Improved SEO for WordPress websites.

Managed WordPress and WooCommerce hosting plans from Nexcess include a built-in Edge CDN powered by Cloudflare.

The integrated CDN solution from Nexcess works with many plugins such as WP Rocket, W3 Total Cache, or a basic plugin such as CDN Enabler.

Site assets being served from the Nexcess CDN can be purged in the site's portal and from the site's admin bar. Other recommended third party CDN solutions include Cloudflare, BunnyCDN, or StackPath.

A number of third party CDN solutions support on-the-fly image conversion, which means that site images will be served to site users using next-gen image formats such as WebP or AVIF if their browser supports it.

6. Install a speed-optimized WordPress theme

Your WordPress theme may be draining your web server significantly. Themes with high-resolution images and effects may be eye-catching, but they could hurt your page load speeds.

To speed up your website, choose a minimal theme that only has the functionality required for your website. You may use plugins or unique CSS files to add more effects in the future.

Premium WordPress theme providers offer carefully coded and speed-optimized themes. Some examples are Kadence, Astra, StudioPress, CSSIgniter, and Themify.

7. Optimize your database

The biggest cause of database bloat is left-over data and database tables for plugins that are no longer used. A number of plugins include a “remove data” setting — but that will need to be enabled before the plugin is deactivated.

The size of your database will be kept to a minimum with database optimization, which involves removing unnecessary data.

Think of it as house decluttering without the pain of throwing away personal belongings. When you remove unnecessary data, you also reduce the file size of your backups. When you get your database in order, your WordPress website will run faster.

Examples of unnecessary data include spam comments, old data, fake users, old post drafts, unwanted plugins, and unused themes.

But what if you’re a data hoarder and need a Marie Kondo to help you spring-clean your data?

You can also use WordPress speed optimization plugins, such as WP-Optimize and Advanced Database Cleaner, for database optimization. Compared with manual data removal, these plugins are faster and more secure.

8. Delete unnecessary plugins

Next, review your site’s plugins and check which plugins are inactive. You should uninstall outdated themes and plugins, primarily for security reasons. This is because hackers may take advantage of those underused themes and plugins.

Also remove duplicative functionality in plugins. For example, you don’t need to use multiple form plugins or security plugins.

Pick which plugin solution works best for your site’s needs and keep that plugin active. If you have many inactive plugins that are no longer used on the site and data has been migrated over, then uninstall those plugins.

By removing these unnecessary plugins, you can reduce the size of your data backups and improve your website’s performance.

You must first disable an unused WordPress plugin before deleting it. Each time you disable a plugin, test your website to make sure everything is still functional. Once you've done so, you can delete any inactive plugins from your list.

You can also look for lightweight alternatives to the plugins you’re currently using to speed up your website.

9. Update your themes and plugins to the newest versions

Outdated plugins or unoptimized themes also can impact the functionality of your website. Suspicious activities, such as hacking and phishing, exploit vulnerabilities in third-party plugins and themes.

Always run the most recent versions of themes and plugins to maintain the security of your website and improve its performance.

10. Use a DNS-level firewall

A popular WordPress firewall plugin (web application firewall or WAF) is DNS-level website firewall. Your website traffic is routed through their cloud proxy servers by these firewalls.

So, it enables them to send only legitimate traffic to your web server.

Due to their exceptional ability to distinguish between legitimate website traffic and malicious requests, we strongly advise using a DNS-level firewall.

DNS-level website firewalls significantly reduce the load on your WordPress hosting server, ensuring that your website does not go offline.

Leading WordPress website security providers like Sucuri, MaxCDN (StackPath), Cloudflare, Wordfence Security, and Jetpack offer DNS-level firewalls. You can use any of them depending on your needs.

11. Make sure you’re running the newest version of WordPress

According to a 2021 Sucuri report, about half of compromised WordPress websites were running an outdated WordPress core when they were infected.

By updating WordPress to the most recent version, you can reduce bugs, security flaws, and performance problems while gaining access to new features.

In recent versions, WordPress added automatic core updates. Most WordPress users now receive automated updates or notifications through their dashboards.

For example, you may receive an email informing you that your website has been updated. There is no need to accomplish any more tasks in that case.

12. Use the latest version of PHP

PHP’s importance in WordPress website development cannot be understated. You should use the most recent version of PHP for your website because it will run faster than older versions and improve user experience.

It is not recommended to use a PHP version that has gone EOL (end-of-life). Security updates for it will no longer be produced and the PHP version will no longer be supported. Using newer PHP versions will also improve the performance of your site. The minimum version of PHP that is recommended to use is PHP 8.0. WordPress is working to improve PHP 8.1 support in core.

Also, it’s important to note that you shouldn’t immediately start using the most recent version of PHP. First, make sure your WordPress plugins (e.g., installation and themes) are compatible with the newest version of PHP.  If you aren’t sure if they’re compatible, you can check with a developer.

13. Minify JavaScript, CSS, and HTML code

If you want to improve your Google PageSpeed score, you should consider minifying CSS, HTML, and JavaScript code.

This simply means removing unnecessary code and shortening variable and function names. The minification process decreases your website’s bandwidth usage and load times by disabling unneeded assets (CSS and JavaScript) from loading. It’s important to note that code minification doesn’t affect the functionality of your website.

Using the test results from either GTmetrix or WebPageTest, look at the waterfall. It will show you the site assets loading on your site. From there, take a look at the slowest assets.

Plugins can end up loading their assets on every page and post on your site rather than to a specific page. That means you can end up with many unneeded CSS and JavaScript files across your site.

For example, if you are running a WooCommerce store, then the payment gateway plugin could be loading its assets on every site page when they should only be loading on the cart of the checkout page.

When reviewing your waterfall results, pay special attention to POST admin-ajax.php requests. Admin-ajax.php requests loading on the front-end of your site increase PHP worker usage and bypass all caching in place on the site.

You can find the plugin that is using that request by looking at the response and then tracking the action back to a plugin. Some common plugin types causing that slow request would be a popup plugin or an email opt-in plugin.

Check how many third-party analytics or tracking scripts load on your site. Externally hosted scripts can be slower to load depending on how fast they are to serve site visitors. It is possible to serve web fonts and analytics from the server, which means you get the gains of browser caching and serve those assets from a CDN.

Does minification sound like a daunting process? In that case, you can also summon the help of WordPress speed optimization plugins, such as WP-Optimize or Autoptimize, which is included in the Nexcess installer. This step could be the missing piece in your WordPress optimization process.

14. Adjust your backup frequency

If you procrastinate on backing up your website, you run the risk of experiencing problems that others have warned you about.

However, backing up your website may have an adverse effect on its speed and overall performance. Some background processes, such as search engine crawling and backup plugins, can cause a website to slow down. Ideally, you should use a backup solution that does not cause performance issues on your site.

To avoid performance issues, ensure that you only run your backup plugin during your website’s low-traffic times.

Nexcess provides a more comprehensive data backup policy than many of its competitors.

For example, free daily backups are included with any Nexcess web hosting plan. These backups are generated automatically and stored for 30 days on a separate backup server.

To ensure data recoverability and security, Nexcess ensures that daily backups are stored on remote servers that are only accessible to internal systems and support staff.

15. Declutter your media library

As your site grows, so too does your media library. You might begin to accumulate images over time that are no longer needed. You should think about deleting any unused material to free up more disc space.

Removing these unnecessary media files (e.g., images and PDF documents) could be a quick fix for your website’s performance issues.

You have two options for manually removing unneeded media. You can navigate to Add Media > Media Library > Unattached. There, you can delete the media files you no longer need.

On the other hand, you can enlist the help of a plugin like Media Cleaner to take your unwanted files to the scrap heap.

16. Display excerpts instead of full posts

WordPress shows the complete content of every article on your homepage and in your archives by default. This slows down the loading times of some parts of your website.

The fact that people don't need to open the original article is another drawback of showing full articles on these pages. This may result in fewer visitors to your website and shorter user sessions.

You can configure your website to show excerpts rather than entire articles to reduce page loading times. Just follow these steps:

From your WordPress admin panel, go to Settings > Reading and select For each article in a feed, show: Summary. (The default is Full text).

17. Break comments into pages

You might not consider user comments to be website content. Yet WordPress is required to load your comment section along with your primary content.

If your website comment section is very popular, it could be slowing down your website. However, you can speed up page load times by paginating comments.

Having different comment pages reduces the amount of content on a single webpage. It also allows visitors to load comments on a post only if they want to, further speeding up page loading.

If you want to break comments into pages, you can follow the below steps.

In the WordPress admin panel, go to Settings > Discussion and select Break comments into pages.

go to Settings > Discussion and select Break comments into pages.

18. Split long content into multiple pages

Compared with short content, lengthy blog posts often rank higher in search engine results. Visitors also might spend more time on websites with in-depth content.

But there’s a catch. Long-form articles with many images may slow down your website, making your visitors unhappy. You may benefit from this WordPress optimization tip if you publish content that digs deep:

You can speed up page loading by splitting long posts into multiple pages. On WordPress, use the Page Break block. If you’re using the Classic Editor, you can insert the tag <!--nextpage--> where you want a new page to begin.

19. Lazy load images

Another WordPress optimization tip is to use lazy loading if your website contains many images. With lazy loading, your website only loads images that are visible to the user in their browser window. Other images load when the user scrolls down to view them.

Because content loads gradually rather than all at once, lazy loading gives the impression that a page is loading faster than it is. Lazy loading can be used for content like images, embedded videos, text, and comments.

The LazyLoad by WP Rocket plugin can be used for images, iframes, and videos.

20. Load Google fonts directly

You can improve your WordPress website’s performance by directly loading Google fonts.

The most basic approach is to directly copy the appropriate font from Google. When you use this approach, your website server automatically seeks assistance from a global CDN to quickly provide fonts from multiple servers across the world.

When you embed these fonts in your WordPress website, you should see an external link to fonts.googleapis.com. Depending on browser requirements, external requests may be sent to fonts.gstatic.com for various web font formats (e.g., WOFF or WOFF2).

You could also use a plugin to serve Google fonts locally. Many themes have this feature built-in as well.

21. Limit post revisions

WordPress automatically makes a copy of your revisions when you save a post and store it in your database. The previous version of your post is not erased. This gives you the flexibility to return at any time to an earlier draft of your post.

Post revisions are helpful. But as they accumulate in your database, they can negatively affect your website’s performance.

WordPress stores unlimited post revisions by default. However, you can restrict the number of revisions saved per post or turn off post revisions.

To limit the number of post revisions, open your website’s wp-config.php file and paste the following code at the bottom of the file.

define( 'WP_POST_REVISIONS', 2 );

This code restricts the number of stored revisions per post to two. You can modify this number to suit your needs; entering 0 will disable revisions entirely. Entering 0 is not recommended if you aren’t logging your changes elsewhere.

22. Host audio and video content externally

WordPress allows direct video and audio uploads, but these uploads are extremely detrimental to website performance. Your website speed will increase if you upload such files to an external hosting service (e.g., YouTube).

The good news is WordPress allows video embedding. That means you can paste the URL of your video into your article, and the video content will be displayed as normal.

User experience will improve when you embed videos. That is because video hosting sites prioritize smooth playback even if users have a slow internet connection.

Alternatively, another easy to use option is VideoPress from Jetpack.

23. Turn off hotlinking

Websites sometimes use a resource that is hosted on another website. This is known as hotlinking.

Let’s say Website B uses a hotlink to an image stored on your website. Website B can show this image without shouldering the cost of hosting or sacrificing website performance.

Instead, your website's performance could be drained, and you’ll get none of the traffic. Sounds like a bad deal for you, right? Here’s how to put an end to this freeloading.

For images, add the following code to your .htaccess file. Alternatively, you can use a security plugin (e.g., All-in-One Security) to simplify this task.

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

You can replace “yourwebsite.com” with your own domain name. This code restricts access to your images to the websites listed in the above code. You can add more websites using the same format if you want to grant permission for them to use your images.

Now you know how to optimize your WordPress website speed

Now that you know how to speed up a WordPress site, you may be on the lookout for a suitable WordPress hosting plan for your website. Nexcess offers optimized ecommerce hosting with a focus on speed, security, and scalability.

If you’re facing issues with the above steps or don’t feel comfortable tackling any of them, Nexcess has your back.

The support teams at Nexcess are highly knowledgeable in a variety of web hosting technologies, such as the tips included in this guide.

Our talented support and monitoring team offers 24/7 services, letting you focus on your WordPress website.

Check out our managed WordPress plans or contact us today to learn more.

This blog was originally published in January 2023. It has since been updated for accuracy and comprehensiveness.

Luke Cavanagh
Luke Cavanagh

Luke Cavanagh, Strategic Support & Accelerant at Liquid Web, brings a decade of experience working with WordPress and WooCommerce to our product team. His GitHub page offers a glimpse into his multiple areas of subject matter expertise.

"Ninja stuff with WordPress and WooCommerce," is an apropos way to describe Luke's savviness with these platforms — and his way of influencing our organization for improving to them.

Coming out of the University of Brighton with a Business and Technology Education Council (BTEC) Higher National Diploma (HND) in 2D & 3D Design, Luke's credentials prepared him well for his current role that blends both web development and design. His HND credential leveraged his foundational learning at West Kent College, where is received a National Diploma (ND) in Graphic Design.

In his personal life, Luke is a devoted husband and teen wrangler. He considers himself a Synthwave enthusiast, Jerry Goldsmith fan, and Doctor Who aficionado. He is happy to introduce his friends and teammates to essential vocabulary for life found only in British English, such as "gubbins" and similar terms.

Mohammed Noufal
Mohammed Noufal

Mohammed Noufal is a B.Tech graduate with a decade of experience in server administration and web hosting. He has a specialization in various cloud technologies and server management, including monitoring, configuring, troubleshooting, and maintenance.

He is a father to two daughters and finds fulfillment in their growth. In his free time, he enjoys blogging about technology, sharing experiences, traveling, making new friends, social networking, and listening to music.

With a strong technical background, family commitment, and creative outlets, he represents a well-rounded life journey.

We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.