Best configuration set up for W3 Total Cache

Last edited:
November 1, 2023
Reading time:
8 mins

/

Blog

/

Speed

/

Best configuration set up...

đź’ˇWe may earn a commision if you subscribe to a service from a link on this page.

W3 Total Cache is a powerful WordPress plugin designed to enhance website performance through caching, minification, and other optimization techniques. Properly configuring this plugin can significantly boost your site’s speed and user experience. In this comprehensive guide, we’ll delve into the best configuration settings for W3 Total Cache. From general settings to more specific options like page cache, object cache, database cache, minification, browser cache, and user experience (lazy load), we’ll explore each setting in detail to help you optimize your website’s performance. Let’s dive in.

💡 Disclaimer: We are not connected, affiliated, sponsored or partnering with W3 Total Cache® in any way. This is just a tutorial for informational purposes, aiming to review the plugin and present a suggested setup for your WordPress website.

General Settings

The General Settings page in W3 Total Cache is the starting point for quickly configuring some of the most critical aspects of your website’s performance. This section serves as your gateway to optimizing your site and ensuring it runs at its best. In this guide, we’ll provide you with recommended settings for the General Settings page, offering a solid foundation for your W3 Total Cache configuration. We’ll then take a detailed dive into each specific section, explaining the rationale behind each choice.

Here’s a quick overview of the suggested settings for your General Settings page. These settings will form the basis of a well-optimized site:

  1. Enable Page Cache: By caching your pages, you can reduce server load and accelerate page delivery. However, remember not to cache pages for logged-in users to ensure that dynamic content remains visible to them. For most websites “Opcode: PHP Cache (APC)” is the option to go with. However for those that don’t have OP cache available, the “Disk: Enhanced” option is a solid choice
  2. Enable Minification for JS and CSS (Without Combining): Minifying your JavaScript and CSS files can significantly reduce their file size and improve loading times. However, for optimal performance on sites with limited resources, it’s best not to combine these files.
  3. Enable Object Cache: Object caching is essential for storing frequently accessed database queries and optimizing your server’s performance.
  4. Disable Database Cache: In most cases, enabling database caching is unnecessary if you already have object caching active. It can occasionally lead to conflicts and unnecessary resource consumption.
  5. Enable Browser Cache: Enabling browser caching is vital for returning visitors, allowing their browsers to retrieve static assets from their local cache, leading to faster load times.
  6. Enable Lazy Load: Implementing lazy loading defers the loading of specific elements until they’re needed, enhancing both user experience and site speed. However, remember to exclude emoji scripts and jQuery Migrate for optimal performance.
  7. Disable scripts: We strongly suggest disabling emoji script (doesn’t mean that we won’t be able to add emojis manually with copy paste in your pages). Also, we advice disabling wp-embed script as well as jquery-migrate (if you don’t use old libraries/plugins).

In the following sections, we’ll provide a more in-depth explanation of each setting and the impact it has on your website’s overall performance.

Page Cache

Page cache default settings are fine. Just make sure review the below points:

  1. Don’t Cache for Logged-in Users: To ensure that your dynamic content remains accessible for logged-in users, don’t cache pages for them. This ensures that personalization and interactions on your site continue to work smoothly.
  2. Adjust Garbage Collection Interval: The Garbage Collection Interval defines how often cached files are cleared to make room for new ones. For websites with content that doesn’t change frequently, consider increasing this interval. This can reduce the workload on your server by preventing too-often cache purging.
  3. Exclude Pages from Cache: There are certain pages on your site that should never be cached, such as your sitemap. Adding the sitemap URL to the “Never cache the following pages” section ensures that your sitemap remains dynamic and up-to-date.
  4. Manage Rejected Cookies: For WooCommerce users or anyone with specific cookies that should prevent caching, add these cookies to the “Rejected Cookies” field. This prevents cache from being served to visitors with WooCommerce-related cookies, ensuring a seamless shopping experience.

Minify JS and CSS

Minification, the process of removing unnecessary characters from your website’s code, can substantially reduce file sizes and improve loading times. W3 Total Cache offers robust minification options for both CSS and JavaScript files.

For websites hosted on lower-resource servers or extensive sites with numerous scripts and styles, it’s advisable to enable minification only. This setting will minify your code but keep CSS and JavaScript files separate. However, if you’re on a high-resource server or your site is relatively small, you can safely enable both minification and file combination. This will merge CSS and JavaScript files to further reduce HTTP requests and speed up your website.

Also, if you have any issues with your builders when editing your site, maybe it’s better to Disable minify for logged in users also (although not suggested for websites with visitors spending a lot of time logged-in.

Lastly, to avoid any further issues you might want to add jquery.min (already minified by definition). We learned this the hard way. In the above example we added the script location in Never minify the following JS files:

wp-includes/js/jquery/jquery.min.js

Object Cache

The object cache is essential for storing frequently accessed database queries, significantly reducing the server load and database queries. However, it’s crucial to ensure that this feature is enabled on your hosting environment. If it’s not, reach out to your hosting provider to address this issue.

Assuming your hosting environment supports it, enable the object cache, and you’ll immediately notice a performance boost. It’s particularly beneficial for e-commerce sites and any other sites with a high degree of database interaction.

Again, default settings are fine here:

Database Cache

Surprisingly, enabling the database cache may not always yield substantial performance improvements, especially when the object cache is already active. In most cases, the object cache takes care of database query optimization.

If you’re running into performance issues even with the object cache enabled, you can experiment with the database cache, but proceed with caution. This setting isn’t suggested to be used as it can sometimes result in conflicts or additional resource consumption.

Browser Cache

Browser caching is a vital component of website optimization. Enabling this feature allows returning visitors to load your site more quickly since their browsers can retrieve static assets like images, styles, and scripts from their local cache. The only thing to watch for here is that brotli compression which is enabled by default in the plugin is also available and enabled in your hosting environment.

The default settings for browser cache in W3 Total Cache are typically adequate for most websites. However, it’s essential to ensure this feature is enabled and functioning correctly. To verify the Browser Cache headers are properly set up, use the developer tools of your browser and in the network tab, choose a file (like a .js file in the image) and verify the Expires header is next year:

User Experience (Lazy Load)

Lazy loading is a technique that can significantly improve user experience and site speed by deferring the loading of certain elements until they are actually needed. However, it’s essential to use this feature judiciously.

In W3 Total Cache, you can configure lazy loading settings to exclude critical elements like above-the-fold images and backgrounds. These are the elements that users see first when loading your pages, and if you also lazy-load those images you practically decrease your PageSpeed scores. Make sure you add the parent classes of the elements that include your above the fold images:

Properly set up your W3 Total Cache

Optimizing your WordPress website’s performance with W3 Total Cache is an effective way to enhance user experience and SEO rankings. By configuring the plugin’s settings appropriately, you can ensure that your site loads quickly and efficiently, whether for logged-in users or first-time visitors. The balance between enabling caching for performance and excluding it for dynamic content is key, along with optimizing individual cache methods like page caching, object caching, and lazy loading. However remember this is not always a plug-and-play solution and make sure to conduct thorough tests after applying any of the above suggestions, as every situation has it’s specific needs.

Leave a Reply

Your email address will not be published. Required fields are marked *