How To Improve Speed And Performance For A WordPress Site


I love WordPress, but it isn’t perfect out of the box.

Themes and plugin choices are more important than ever as some can hamper the site’s performance.

You can do many things to improve any WordPress site, and this post will cover just some of these optimizations that you can (hopefully) take action on immediately.

Choose A Reputable Web Hosting Company

Choosing a bad host can be harmful to a site’s performance.

While hosting on a shared server may seem the most cost-effective solution, it definitely comes with its issues. Sharing that server with other (potentially) troublesome sites can monopolize shared resources to the detriment of your own.

Hosting doesn’t cost the earth. I would always advise that you choose a web host that not only has great hardware specifications (on a dedicated server if budgets allow) but also understands both WordPress and has strong technical support. And look for hosts with server-level caching.

Whether your site resides on a managed WordPress hosting platform, a LiteSpeed server, or scalable cloud hosting, it’s always worth doing your own research and comparing a few companies before deciding.

Also, consider how SEO-friendly that host is. WordPress has a hosting page with a handful of recommended companies.

Optimize Server Settings And Use CDNs

Once the site is hosted on the server, there are further optimizations you can apply at the server level.

Newer protocols like HTTP/3 and QUIC reduce latency, especially on mobile devices.

Cloudflare and LiteSpeed support this out of the box, but it is still worth checking with your server settings as well.

There are several CDNs available, but my recommendation has always been to use Cloudflare.

Their free plan offers many optimizations, including image polishing, caching and compression (enable tiered caching to further optimize those requests).

I also recommend their automatic platform optimization (APO) offering costing $5 per site, or free with any of their paid plans.

Within Cloudflare, I recommend caching everything except wp-admin and dynamic content, serving stale content while revalidating cache in the background and using their Web Application Firewall (WAF) services that help block attacks and limit crawlers.

Disable XML-RPC

There are several optimizations to remove and limit resources that are enabled by default in WordPress core.

One good recommendations here would be to disable XML-RPC if it is not required:

Disable XML-RPC

add_filter('xmlrpc_enabled', '__return_false');

Implement Caching & Compression Techniques

In addition to server optimizations, you can implement further performance enhancements by adding caching and compression elements directly.

Using object caching such as Varnish or Redis can provide great results, as well as setting proper cache-control headers within.htaccess (Apache) or nginx.conf:


    Header set Cache-Control "max-age=31536000, public"

Optimize Asset Loading

When caching and compression are in place, you can then take further steps to defer JavaScript.

For example:

Also, try to have any scripts load asynchronously so that they don’t degrade initial page load times.

When it comes to CSS, it’s always good to remove any unused styles where possible, although I wouldn’t say this is the biggest priority compared to other recommendations in this post.

Also, try to preload and pre-connect fonts for text that appears above the fold (custom fonts for the text in the footer doesn’t need to be preloaded) and other external resources where possible.

Here is an example of how this can be done:

Close Other Performance Gaps

If you’re a perfectionist like me, there’s always room for more optimizations.

  • Enable lazy loading for images where possible and replace YouTube embeds with static image previews.
  • Use Screaming Frog to detect unnecessary redirects.
  • Close redirect loops and chains, which are reported within Semrush site audits. Update internal links to point directly to the final destination URL.
  • Reduce third-party requests where possible. For example, load Google Analytics or Google Fonts locally instead of via external scripts.
  • Disable unused social media widgets and embeds.

Choose The Right Themes & Plugins

So, you have your hosting account set up and your WordPress site installed.

However, the abundance of choices you have when it comes to themes and plugins makes it hard to decide and choose trusted developers. This is a challenge that has always been present, and I have been writing about it since 2013 at least.

When  choosing both themes and plugins, consider the following when doing so:

  • Is the theme compatible with the most recent versions of WordPress?
  • Does it adhere to WordPress best practices for theme and plugin development? You can check this using the Theme Check plugin for themes and the Plugin Check for plugins.
  • Does the author of the theme have developer E-E-A-T? Can you trust them?
  • Ensure there isn’t too much code bloat. The more a theme is generalized to the masses (e.g., “all-in-one themes for any business”), the more it will have to be developed to accommodate the widest of audiences. The more bespoke the theme, (presumably) the less of a chance of code bloat.
  • Read reviews and investigate support offerings. For themes and plugins offered within WordPress’s own repo, some reviews and ratings are always helpful to inform your decisions.

Most themes offer live previews, so it’s worth running those URLs through speed testing tools such as PageSpeed Insights, Web Page Test, and Chrome DevTools.

Apply Some WordPress-Specific Optimizations

Still not done with my perfectionism! Here are some recommendations on WordPress.

The WP Heartbeat API can create unnecessary AJAX requests. Reduce its frequency or disable it:

add_action( 'init', function() {
    wp_deregister_script('heartbeat');
});

You can also limit post-revisions and revision time intervals in wp-config.php:

define('WP_POST_REVISIONS', 5);
define('AUTOSAVE_INTERVAL', 300); // 5 minutes

Disabling unused Gutenberg block CSS is also recommended if not needed:

add_filter('use_block_editor_for_post', '__return_false');

Use Recommended Plugins

With so many plugins available today, it seems daunting to know which ones are the best and most trusted.

Of course, “it depends” comes into play again, but generally, I advise using as few plugins as possible.

If you can solve some issues away from a plugin (e.g., server-level), then do that first.

Depending on what optimizations you may have set up elsewhere, some of these plugins may be unnecessary to install, but if not, it’s always good to know preferable options.

  • Caching and compression: Autoptimize, W3 Total Cache, or Jetpack alongside WP Super Cache and Jetpack Boost.
  • Preloading: instant.page is a great recommendation here. Uses one line of code that you can implement or they offer a WordPress plugin that does the same.
  • Script deferring: Some plugins above offer this, but I personally use WP Meteor.
  • Image optimization: TinyPNG or Smush for image compression, WebP express for serving WebP images over PNG/JPG/EPS. For further optimization, use Edge Images for utilizing edge transformation services to - How To Improve Speed And Performance For A WordPress Site markup.
  • SEO: While not directly connected to improving speed, Yoast SEO optimizes a site’s visibility performance [disclosure, I work for Yoast]. Most of these features provided in the free version help with this, but things such as IndexNow are included within Premium. However, if you want to enable IndexNow without Premium, Bing offers its own plugin.

When installing any plugin, it’s always good to look at all settings properly and disable anything that is unnecessary to save more processing time and reduce code bloat.

To take this to the next level, you may also want to install Plugin Organizer, which allows you to set conditions for plugins to load only within relevant pages/areas of the site.

Monitor Your Server

Lastly, it’s always good to have a good monitoring system, such as New Relic, on the server.

This system allows you to diagnose and fix any issues that may be hampering the site or server’s performance, as well as reduce further unnecessary server load by disabling non-essential PHP modules.

You can also set up logging for slow queries in MySQL:

SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 1;

I also recommend the Query Monitor plugin. Or, installing Blackfire to pick up inefficient code snippets which cause slow server response time. It is a paid too, but highly recommended for enterprise level.

Error logs are always your friend, too, when diagnosing other issues.

WordPress also offers debug mode, which is extremely useful for diagnosing potential problems by adding the following in wp-config.php:

Note, this should never be enabled on a live production site as it may expose sensitive information. Use on staging only.

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

Conclusion: Enhance WordPress Performance While Preserving Functionality

As you can see, there is a lot one can do to improve a WordPress site, and it’s important to do so from multiple angles.

Do as much as you can above, ensuring the site functions as it should.

Test everything first to ensure everything you need is correctly implemented and doesn’t hamper other things on the site (e.g., sometimes caching or compressing JavaScript can create irregularities or stop some site elements from working) or make other conflicts. And then deploy!

More Resources:


Featured Image: Gorodenkoff/Shutterstock



Source link

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

We Know You Better!
Subscribe To Our Newsletter
Be the first to get latest updates and
exclusive content straight to your email inbox.
Yes, I want to receive updates
No Thanks!
close-link

Subscribe to our newsletter

Sign-up to get the latest marketing tips straight to your inbox.
SUBSCRIBE!
Give it a try, you can unsubscribe anytime.