How to Optimize Your WordPress Site’s PerformanceBy Adrian Try
This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.
More from this author
You don’t want a slow website. Potential visitors may leave before your page even finishes loading. And you’ll be penalized in search results, meaning even less traffic.
You want your web pages to load in two seconds or less. How do you achieve that? One step at a time.
In this article we cover a list of items you can optimize to speed up your WordPress site. In our next article, we’ll give you a list of plugins that will help.
Just How Slow Is My Site?
Your site may not feel slow to you. Most likely your browser has already cached it, so you won’t be experiencing it the same way as a new visitor.
Here are some services that will inform you how long your page takes to load and tell you the overall file size of your page:
Check the speed of your sites before and after tweaking your site for performance. If you can get your pages loading in two seconds, you’re doing well.
Keep a record of how much difference each step you take makes. What made the most difference?
1. Choose a Good Web Host
It’s impossible to speed up a website that’s being hosted on a slow server. Choosing the right hosting provider is the first important step towards having a fast-loading website.
How do you choose a company that makes speed a priority? Check out our Performance Checklist in The Ultimate Guide to Choosing a Hosting Provider.
SitePoint recently partnered with SiteGround as our official recommended host. With servers on multiple continents and the use of the latest SSD hardware, an in-house caching tool, and a free CDN service, SiteGround provides and invests heavily in speed acceleration. Their flexible servers support PHP7 and HTTP/2 and they have ongoing software and hardware updates.
2. Optimize Your Theme
First, use a fast theme. Themes with a lot of options make your job easier, but at the expense of making the web server and browser work harder. Some WordPress themes are megabytes in size, adding seconds to your page loading time.
Every feature you don’t use slows your site down for no reason. If you’re comfortable tweaking code, choose a theme with fewer options to speed up your site.
- The default WordPress themes are easy to tweak, lightweight, and well-coded. Consider using one and either tweaking the code yourself, or hiring a developer.
- Thesis and Schema are two more themes that prioritize performance.
- Finally, SitePoint’s own WordPress Base Theme is another excellent starter theme. It’s light-weight and fast, hitting 98/100 on the Pingdom Page Speed Test.
- What is the Best WordPress Theme?
- 9 of the Most Popular Free WordPress Themes
- How to Design a Complete WordPress Website With Base Theme & Elementor
Second, use a responsive design. These load less resources for mobile devices, or specify high-res images for desktop displays. Mobile users don’t have to download huge images, while desktop users don’t have to squint at tiny ones.
Responsive sites are also preferred by Google, so expect a slight boost in SEO once you switch.
3. Monitor Your Plugins
First, minimize the number of plugins you use. Before you install any plugin, ask if it’s really necessary. Having a large number of plugins installed won’t make a huge difference to the speed of your site, but it increases the risk of installing badly behaved plugins.
Second, make sure your plugins are optimized for the current version of WordPress. Perform some research before installing a plugin, especially if it is rated three stars or less. It may be poorly developed, or use inappropriate hooks. This will slow down your site, and may also adversely affect WordPress and your other plugins. It’s also important to keep plugins updated to ensure you have the latest performance improvements, security patches, and features.
4. Optimize Your Widgets
If a widget is unlikely to be updated often, upload it directly to your server. By not having to rely on external servers, you’ll improve your site’s loading time.
5. Optimize Your Static Content
First, compress static content with gZip. Compressed files are smaller, so will obviously load faster.
- The best option is to enable gZip compression straight from cPanel (if your host offers you that) if you’re on a shared server.
- You can enable gZip compression using a plugin like W3 Total Cache. We’ll cover plugins in our next article.
Second, take the load off your web server with a CDN. Your static resources (like images, scripts and CSS files) will be served from optimized Content Delivery Network servers all over the world—generally the closest server to your visitor. And your web server will be freed up to serve the rest of your site, improving performance.
Ideally, look for a web host that offers a CDN in its hosting plans, like SiteGround. There are also lots of CDN networks out there:
These work with the caching plugins we’ll cover next time.
Here’s some further reading about CloudFront:
6. Optimize Your Images
Images are one of the heavier elements of your site – they make up over 65% of web content. There are a few ways you can optimize your uploaded images.
First, specify maximum image dimensions for thumbnail, medium, and large sized images. You’ll find these options in Settings/Media. If you upload a 1024px image and your content area is only 604px wide, the image will be scaled down using CSS. The resulting pre-resized, 604px wide image will be significantly smaller to download.
Second, smush it! This technique reduces image file sizes losslessly, without resizing them or downgrading their quality. While Yahoo killed the Smush.it service a few years ago, there are alternatives like reSmush.it, and a number of plugins which we’ll cover in the next article.
Third, employ lazy loading. This technique is effective for image-heavy sites. Images are only loaded when they become visible, not when the page is initially loaded. This can speed up page load times dramatically, though there will be a delay when displaying images when they scroll into view.
Fourth, choose the best image format for your website. Some image formats are easier to work with, while others are smaller. For example, scalable SVGs have smaller file sizes, especially if you optimize them for the web and compress them with gZip.
Learn the pros and cons of a variety of image formats here:
- What Is the Right Image Format for Your Website?
- Is Using SVG Images Good for Your Website’s Performance?
Fifth, use CSS sprites. Performance is improved by combining lots of small theme and miscellaneous images into as few images as possible. Learn more here:
Finally, check out this comprehensive overview of optimizing images:
7. Optimize Your Database
WordPress pages load from a mySQL database. Over time, the database may contain a lot of information you no longer need. Optimizing your database removes this information and improves performance.
You can optimize your database directly from phpMyAdmin. You can also optimize it with plugins. We’ll cover these in our next article.
8. Speed High-Traffic Sites with Caching
Caching is very effective at optimizing high-traffic sites. Every time a WordPress page is loaded, information is retrieved from your database and CSS files, and is combined into a HTML file which can be loaded into the visitor’s browser. This takes time.
Caching keeps those HTML files available for future visitors, saving significant time. We’ll cover caching plugins in our next article.
9. Perform Routine WordPress Maintenance
Keep your WordPress site in tip-top shape by regularly maintaining it. Some maintenance routines can significantly speed things up, in particular:
- Keep WordPress and your plugins up to date.
- Delete old post revisions.
- Delete spam comments.
Learn how to do these and much more here:
10. Further Tips
- Empty your trash. There can be a lot of trash in your database that will slow your site’s performance. By default, WordPress automatically deletes trash after thirty days. You can empty the trash manually from your dashboard, and we’ll share some helpful plugins in our next article.
- Turn off trackbacks and pingbacks. These use server and database resources every time someone mentions your site. Turning the setting off (from WordPress’ Discussion settings) won’t destroy the backlinks, just the work that is generated.
Have a Go!
How slow is your site? Use one of the tools listed above to find out. Then try one or more strategies and test your speed again. Then repeat.
As we’ve noted, there are many WordPress plugins that can help optimize your site. We’ll give you a detailed list in our next article. Stay tuned!
SiteGround, our preferred hosting provider, allows you to use powerful performance optimization techniques with just a few clicks. Their guide to improving WordPress performance includes full tutorials on many of the topics we’ve covered in this article, including caching, gZip compression, using a CDN, optimizing images, and optimizing the WordPress database.
Which optimization strategy made the most difference on your website? Let us know in the comments.