Products

W3 Total Cache. The Most Complete WordPress Performance Framework

Improve Site Performance Via Caching

W3 Total Cache improves the user experience of your site by improving your server performance, caching every aspect of your site, reducing the download times and providing transparent content delivery network (CDN) integration.

Improved page load times

Reduced page load times can increase visitor time on site and number of pages viewed, in addition to improved conversion rates.

Optimization score improvements

Dramatic improvements in YSlow and Google Page speed scores possible when W3 Total Cache is fully configured.

Improved user experience

Page cache and Browser cache configuration gives visitors perception of “instant” repeat page views.

Significant bandwidth savings

Up to 80% Bandwidth savings via Minify and HTTP compression of HTML, CSS, JavaScript and RSS feeds.

The Most Complete WordPress Performance Framework

The fastest and most complete WordPress performance optimization plugin. Trusted by many popular blogs like: mashable.com, pearsonified.com, noupe.com, webdesignerdepot.com, freelanceswitch.com, briansolis.com, tutsplus.com, yoast.com, css3.info and others — W3 Total Cache improves the user experience of your blog by improving your server performance, caching every aspect of your site, reducing the download time of your theme and providing transparent content delivery network (CDN) integration.

dummy-feature
dummy-feature

Why is W3 Total Cache Better Than Other Cache Plugins?

It's a complete framework. Many of the popular cache plugins available do a great job at achieving some performance aims. Our plugin remedies numerous performance reducing aspects of any web site going far beyond merely reducing CPU usage (load) and bandwidth consumption for HTML pages alone.

Equally important, the plugin requires no theme modifications, modifications to your .htaccess (mod_rewrite rules) or programming compromises to get started. Most importantly, it's the only plugin designed to optimize all practical hosting environments small or large. The options are many and setup is easy.

Free Download
Fill out my online form.

General

Who is this plugin for?

Anyone that wants to provide an optimal user experience to their readers.

Umm, why?

We needed an elegant remedy to common performance issues we spent countless hours addressing on various blogs we work with. They all suffered from similar issues and we found that same remedies would sort all of them. Issues like HTTP transaction reduction, object size reduction and blocking objects are performance killers and have been remedied with this plugin. Rather than release our various plugins individually (and support them independently) we saw an opportunity to demonstrate how all of this functionality is intertwined and combines to realize far more than the sum of its parts.

One of the WordPress community’s strengths is also its weakness; we found that numerous plugins are very handy and save some development time in a pinch, but the maintenance and performance penalties blogs suffer from as a result contribute to a poor user experience, which is never acceptable.

Experience has shown that fast loading web sites have (at least) the following characteristics:

  • Reduced attrition
  • Higher conversion rates for e-commerce / affiliate etc sites
  • Increased time on site / more page views per visitor

In fact, if wordpress.com (for example) applied some of the techniques used in this plugin, we imagine they’d realize ~10% performance improvement on the CSS, JS and HTML (respectively) on the millions of blogs they host.

As a practical matter, Akamai and JupiterResearch did a study on acceptable wait time for retail web sites to load back in late 2006 concluding that users may leave after 4 seconds of waiting. That was several years ago now, even before 3G was available for mobile devices, what do you think web users expect today? According to Marissa Mayer of Google, as she stated the same year as Akamai, improving the speed of sites/applications reduces the learning curve for applications and contributes to higher use. It’s time to bring the performance major corporations enjoy to the blogosphere.

As an aside, don’t you think your site’s KPI would be more meaningful if you could be confident that all users were having the exact same performance experience with your site? It’s too early to say for sure, but we feel that the statistics and metrics we all use to track our progress and results will be more realistic when W3 Total Cache is actively removing bottlenecks from our blogs.

Please let us know what kind of mileage you have.

So give me the skinny, what are the highlights?

W3 Total Cache is a suite of functionality designed to optimize the performance of all WordPress blogs. Features and benefits include:

  • Improved progressive render (non-blocking CSS and JS embedding)
  • Reduced HTTP Transactions, DNS lookups, reduced document load time
  • Transparent content delivery network (CDN) support with automated media library import
  • Bandwidth savings via HTTP compression (gzip) for HTML, CSS and JS
  • Minification (concatenation, white space removal) of inline, external or 3rd party JS and CSS with scheduled updates
  • Optional embedding of JS just above </body>
  • Support for caching pages, posts, feeds, database objects, CSS, JS in memory with an opcode cache or memcached or both
  • Caching of feeds (comments, page and site), URLs with query string variables (like search result pages), Database queries, Pages, Posts, CSS and JS
  • Complete header management including Etags
  • Increased web server concurrency and reduced resource consumption, increased scale

In essence, anything that can be automated to squeeze out every bit of server performance and minimize bandwidth utilization has been done, leaving your readers with an optimized user experience.

I don't have time to deal with this, but I know I need it. Will you help me?

Yes! Please reach out to us and we’ll get you acclimated so you can “set it and forget it.”

I've never heard of any of this stuff; my blog is fine, no one complains about the speed. Why should I install this?

Rarely do readers take the time to complain. They typically just stop browsing earlier than you’d prefer and may not return altogether. It’s in every web site owner’s best interest is to make sure that the performance of your blog is not hindering its success.

But even Matt Mullenweg doesn't agree that additional caching is so important, why bother?

You’re right, Matt did say that. However, this plugin provides more than just “caching”. Because he is correct, the web is dynamic and must remain so. But as we explain throughout this FAQ, our goal is to improve the performance of any blog. Furthermore, some techniques we use are well documented from past WordCamp presentations; we combined them in a way that we have found stands up to the highest traffic spikes.

And how many years of university do I need to use this thing?

-4 — That’s right; a youngster in junior high school can get started with this plugin. Seriously, if you did your own WordPress install or have ever installed a plugin before you’re in good shape. If you need help, let us know or perhaps we’ll make some videos or the like.

Ok, so the benefits are clear. What exactly is so special about *how* this plugin works?

Thanks for asking. We just decided not try to use the typical WordPress hooks and methodologies to implement our features, instead we take the normal output and perform optimizations to it before we send it to the user agent using a method they support and then cache the result afterwards. This concept is applied to objects you decide to cache.

So let me get this straight; you're telling me this plugin is designed to improve performance of any WordPress blog?

Precisely, that is unless you don’t write any posts in your blog nor have any readers. If you’re someone that’s always into the latest web development technique or plugin, now you can “have it all” without making your readers suffer.

This is too good to be true, how can I test the results?

I understand the database caching and the page caching, but what's minify all about?

We’ll just quote the fine folks at yahoo on this one:

“Minification is the practice of removing unnecessary characters from code to reduce its size thereby improving load times. When code is minified all comments are removed, as well as unneeded white space characters (space, newline, and tab). In the case of JavaScript, this improves response time performance because the size of the downloaded file is reduced. Two popular tools for minifying JavaScript code are JSMin and YUI Compressor. The YUI compressor can also minify CSS.

Obfuscation is an alternative optimization that can be applied to source code. It’s more complex than minification and thus more likely to generate bugs as a result of the obfuscation step itself. In a survey of ten top U.S. web sites, minification achieved a 21% size reduction versus 25% for obfuscation. Although obfuscation has a higher size reduction, minifying JavaScript is less risky.

In addition to minifying external scripts and styles, inline <script> and <style> blocks can and should also be minified. Even if you gzip your scripts and styles, minifying them will still reduce the size by 5% or more. As the use and size of JavaScript and CSS increases so will the savings gained by minifying your code.”

developer.yahoo.com

What do you use to minify?

We use: minify but may support various engines in the future. Based on John Resig’s suggestion we’re currently looking at YUI Compressor and Google Closure Compiler (for JavaScript) also.

Will this speed up WP Admin?

Yes, indirectly — if you have a lot of bloggers working with you, you will find that it feels like you have a server dedicated only to WP Admin once this plugin is enabled; the result, increased productivity.

Does this plugin modify how the WordPress core works?

No. No theme changes, special files, WordPress core file modifications or special permissions need to be set.

Seriously, tell me what the downside is, there must be something?

Well, no there isn’t. Installing the server side software might be challenging for some, but we can assist with that if you ask. Other than that, unless you enjoy frequently upgrading your server plan or buying more servers and paying for bandwidth overages or wincing every time you add another “must have” plugin to your blog, we cannot find any reason to deter you from the use of this one.

If this plugin does everything you claim, why would you give it away free? Cui Bono?

Who benefits? Everyone. Of the numerous, here are the three the most important reasons we share with the WordPress community:

  • WordPress is free and high quality, plugins should be too.
  • There’s no reason your blog shouldn’t be able to perform as well as well as any major corporation’s web site/application.
  • Google and Yahoo offer quite a bit, but they did not offer a WordPress solution yet. This is our contribution to speeding up the web (starting with the blogosphere).

Who in the world uses memcached or an opcode cache etc anyway?

Great question! Basically anyone that needs to make their application scale. For example, WordPress.com, Twitter, Facebook, LiveJournal (the inventors of the software) and so on all use some sort of memory cache to increase application performance.

We run many blogs on many servers here at my company, is this plugin still for me?

Yes, especially if you have a cluster and many WordPress installations or a WordPress MU installation, then plugin is for you. It will allow you to move easily from multiple installations to WordPress MU and continue to use multiple HTTP, Database, Network Attached Storage etc servers in any configuration you wish. You can also specify as many memcached servers as you wish, although you cannot yet delegate a memcached server to a specific type of caching, i.e. there’s no pool management yet.

So you appear to know what you're talking about, will there be any negative effect on my SEO rankings?

To answer, first we must assume that you’re using all of the options we offer: HTTP compression, minify etc. Having said that, we are only sending compressed data to user agents that support it; even most search engine crawlers do. As for minified HTML, this is essentially how crawlers see your page anyway when they download it. So no, there’s no penalty or compromise.

Fact of the matter, there was a time when the semantics and size of your HTML file (code-to-content ratio), was a factor in a more favorable ranking. POSH HTML has always been preferred by search engines. In some markets this may still be true, so give the search engines what they want.

What about my robots.txt, sitemap.xml and all my site verification files etc, what happens with those?

If you’re concerned about what happens with these when the CDN functionality is active, nothing does. You do not want or need these files moved from their original locations and HTTP compression (or minification for that matter) is of no consequence in most cases.

Do you have any tricks for "post-loading", "lazy-loading" and other render optimizations in this plugin?

Yes we do, we’re currently evaluating if they are best introduced into this plugin or as standalones. Feel free to chime in.

I want to obfuscate my JS, does the plugin do that? Will it ever?

No the plugin will not do that and it’s unlikely that we’ll support that.

I have some ideas for more features, can I write my own add-ons for your plugin?

Not yet, we are considering support for add-ons. Meanwhile, please reach out to us and let us know what you think would benefit the community.

Who do I thank for all of this?

It’s quite difficult to recall all of the innovators that have shared their thoughts, code and experiences in the blogosphere over the years, but here are some names to get you started:

Please reach out to all of these people and support their projects if you’re so inclined.

PRO version: Which Pro features are currently available?

Pro features available:

  • Fragment cache
  • Genesis Extension

PRO version: How do I enable Pro mode on a site that is not registered, i.e a site that was not used for purchase such as local development site?

Add define(‘W3TC_PRO_DEV_MODE’, true) to wp-config.php and resave the license key.

Usage

General

In the past, I always had to modify my theme to run dynamic code. Don't I need to do that again for this plugin?

For now no; there are some special cases that we will address with an upcoming release for highly dynamic sites.

What's this thing doing? Where are the statistics?

Right now we do not show the statistics in WP Admin, but soon we will provide graphs of: Page Cache Memory Use, Page Cache Hits/Misses, DB Cache Memory Use, DB Hits/Misses, Average Page Compression Savings, Average CSS Compression Savings, Average JS Compression Savings, Average Requests per Second, and Average Page Execution Time.

How can I tell if it's working? Aren't there any statistics at all?

Well yes actually there are, simply enable debug mode on the “General” tab to have details appended to the bottom of your HTML source. Remember that when enabled all visitors to your blog can see these statistics if they view source. Using debug mode does slow the performance of your site so use sparingly.

I'm not a hardcore developer, can you explain to me how this // and / stuff works and how I should specify the paths for CSS and JS files?

You mean on the minify settings page right? Ok, it’s simple:
// tells the plugin to search for the file with the provided path from the document root, e.g.: ///JS/jquery/jquery.JS
/ tells the plugin to search for the file with the provided path from the server root, e.g. //JS/jquery/jquery.JS

In most cases providing an absolute path is sufficient and most reliable. You can of course use relative paths, but we discourage it unless you really know what you are doing.

Which features can I use if I haven't yet installed an opcode cache or memcached?

Memory caching will not be possible. However you will be able to use both the page cache and minify in “disk” mode, as well CDN functionality without issue.

Which textareas for file entries support regular expressions?

  • Page Cache: Never cache the following pages, Cache exception list, Non-trailing slash pages
  • Database Cache: Never cache the following pages
  • CDN: Custom file list, Rejected files
    The CDN fields only support regular expression on the filename.

Examples (Never cache the following pages):

  • Do not cache page/directory and sub pages
    /directory*
  • Do not cache pages under a directory
    /directory/.+
  • Do not cache pages that contain specific text
    /.*text.*
  • Do not cache pages that is named child in directories
    .+/child
  • Do not cache any pages named child
    */child

Note: To disable page caching of specific theme templates or plugin files you need to add define(‘DONOTCACHEPAGE’, true); to it.

Caching

How fast will the cache be updated?

Items expire from the cache at a rate that you specify. As far as how fast changes appear to your visitors, they appear instantly in most cases and if you’re an administrator who’s logged in they will always be immediately visible.

My server is state of the art with 15,000 RPM RAID, why do I need to cache anything in memory?

Even if your server was using an array of solid state disks (SSD), your server’s RAM is still going to be faster and introduce less overhead to access than even the fastest solid state drives on a PCIe bus. If you didn’t invest in solid state disks for your server, then even worse off – at least an order of magnitude speed difference in read operations in RAM versus HDD. For write operations delta the latency differences is even more pronounced. RAM is the winner hands down. We won’t even discuss the blocking and arbitration issues that happen with disk arrays under certain circumstances.

Why would I choose opcode caching over memcached or vice versa?

There’s no straight answer for this one. Since WordPress is a PHP-based application, we encourage everyone to install an opcode cache and realize a minimum of 10x performance gain. It will obviously make our plugin faster as well, so again please check out the installation instructions if you do not already use an opcode cache. Once installed, you can select an opcode cache as the method and get back to blogging.

Opcode caching does have a couple weaknesses:

  • If you frequently restart your web server (e.g. apache) especially during high traffic periods, you will lose your cache and your site will slow down as it rebuilds the cache (which happens very quickly). However if you use memcached you would not lose your cache if your web server is restarted.
  • More importantly, opcode caching is best suited for single server environments because the cache is only accessible to the local server, it cannot be shared with other servers in a multi-server (cluster) environment.

It would appear that using APC database caching may be best, but your mileage may vary. So depending on what software you install and how you manage your server, you can choose the options to fit your needs. If you need help with the install on your dedicated or virtual dedicated linux-based server ask us!

I already use HTTP compression on my server, why does it matter if I minify my code?

Let’s say you had a file of 10240 bytes, which becomes 2048 bytes when compressed, savings of ~80% (typical for CSS files). That same file will now have an additional ~3x-10x transfer speed improvement when minified. That’s a big return from a small operation. The larger your files, the more significant the proportional performance gains.

Page Caching

How do I make some specific pages stay dynamic?

They never stop being dynamic, we just don’t create pages that have not been changed. If you have a page that updated frequently in your blog before, it will still remain up-to-date at all times.

Why would I want to cache my feeds?

We feel that caching objects after the first request and checking for updates before responding subsequent requests (which is kind of how web browsers work too) creates more opportunities for interesting applications and mashups where the blogosphere doesn’t require institutional investment to be able to handle developers making hundreds of requests every day the same way we use Google, Twitter and Facebook (for example) APIs today. Think about it, even when major search engines crawl your site, they have to be “gentle” so they don’t bring it down, let’s turn the paradigm around so that every blog can deliver content in real-time in various formats.

How do I cache only the home page?

Add “/.+” (without the quotes) to page cache “Never cache the following pages” option on the page cache settings tab.

Sitemaps are not being cached. How do I resolve this?

Enable “Cache feeds: site, categories, tags, comments” on the “Page Cache” settings tab. Some sitemap implementations are considered by WordPress to be “feeds.”

Minification

How do I find the JS and CSS to optimize (manually minify) them with this plugin?

View your page source in your browser and search for any <style>, <link> or <script> tags that contain external CSS or JS files and one by one add them to the minify settings page. Do not include any CSS in conditional statements (unless you know what you are doing) like:

<!–[if lte IE 8]><link rel="stylesheet" type="text/css" href="/wp-content/themes/default/lte.css" media="screen,projection" /><![endif]–> Or simply use the “Help” tool available on the minify settings page which will identify CSS and JS files used in the templates of your theme and properly assign them to the same. Simply tick the checkbox for files you wish to minify, click “Apply & close”, then save your settings.

The plugin will combine, minify, HTTP compress and check for updates to these files automatically from now on. If you have any CSS or JS that are inline consider making them external files so that you can use them with minify.

I've used the plugin to optimize all my theme's JS and plugins JS, but there are some function calls, where do those go?

Just place them above </head> if that’s where your embed is done or above </body> if that’s where you need them. Wherever they need to be to be called after the JS that needs them, it’ll be fine.

Can I use scripts that generate CSS or JS with this plugin?

Yes you can, but since there are numerous ways to do so, so be sure to test your results carefully. Having said that we do encourage it as it will mean that less processing has to be done to deliver your pages.

Why would I want to put my JS at the bottom of the page?

First let me point out that in many cases we suggest putting all the JS that’s not required for interactivity with your site at the bottom of the document. Anything JS that makes the site work as intended we suggested embedding in the <head>. Depending on your specific situation, having the majority of your JS at the bottom of the document will mean that your visitors won’t have to download things they don’t want to begin interacting with your site or reading it’s content. Quite often the additional HTTP transaction is worthwhile.

Does it really matter if I remove the line breaks from my code?

Definitely. Removing white space from your files make gzip (HTTP compression) more effective.

What's the benefit of removing HTML comments from my code?

Many developers like to have comments in the code for various reasons, however these comments add no value from the blog readers (or search engine for that matter) point of view and only contribute to increased load time and wasted bandwidth as a result. Now only you can use them and view them in your site (as a logged in administrator viewing the page source), which is really what (we assume) you intended.

Why is <link> used to embed CSS instead of <style>?

<link> is a non-blocking method to embed CSS into a document. We recommend this approach for optimal performance.

Why do I care of JS or CSS is "blocking" or not?

In the case of objects (files) you don’t host yourself, this could add several seconds to your page’s load time as the DNS lookups, HTTP transaction roundtrip times and wait times add up. Even when all the scripts are hosted locally, the same adversities exist. Since all objects in the <head> of a document have to be ready before the page can be rendered, having them load in a parallel fashion as opposed to linear (or near linear) gives night and day results.

What does this plugin do to inline CSS and JS?

Nothing yet. We’re evaluating use cases to deal with common issues (like inline CSS for tag clouds for example).

Ok I get it, this all sounds nice and everything, but is this perfect?

Pretty much. If you monetize your blog with ads you will want to spend some time making sure that the ad code works well with your optimization settings. There are also the occasional pieces of code that conflict with the others and have to be in a specific order to work well, but that’s not a problem that this plugin introduces.

Will this plugin break my theme by changing the order of conditional statements or the like?

No, the plugin looks for conditional statements in your markup used for CSS (and sometimes JS) and makes sure that the minified files precede it, so keep that in mind.

Can I use packed or obfuscated JS with this plugin?

Yes and no. In general, packed JS cannot be minified reliably. Obfuscated JS also is hit or miss. A minified and gzipped JS file will be smaller than a packed file in any case, so using the (uncompressed, unpacked or un obfuscated) developer versions of your plugins is no longer a concern when using this plugin. Alternatively, you can use the non-blocking embed option to continue to use your packed or obfuscated file without minification.

What about comments? Does the plugin slow down the rate at which comments appear?

On the contrary, as with any other action a user can perform on a site, faster performance will encourage more of it. The cache is so quickly rebuilt in memory that it’s no trouble to show visitors the most current version of a post that’s experiencing Digg, Slashdot, Drudge Report, Yahoo Buzz or Twitter effect.

What if I accidentally specify an incorrect path to a CSS or JS file?

Unfortunately a 400 bad request error may be generated. So use the “Check URI” button to make sure that you have entered the correct URL or path to the file.

Does the plugin automatically remove duplicate JS?

No. If you include a script in the minfy settings twice or it already exists in your theme we do not automatically remove the extra code. That’s tricky business and it’s better for us to just let you make the decisions conscientiously.

I have some CSS classes with declarations being overwritten or JS with dependencies, do I really have to copy and paste all my CSS and JS file settings around?

No, you can drag and drop them into the desired order on the minify settings page.

Why does your plugin change the order of my <script> and <link> tags (in the <head>)?

Steve Souders identified that placing inline scripts between JS and CSS embeds creates a blocking situation, so we’re try to help you avoid that. If you’d like to experiment with various scenarios related specifically to your blog, we recommend Steve’s tool, Cuzillion. Have some beneficial input on other common cases for WordPress users? Reach out to us.

I can't read this minified HTML; can you give me a break please?

Happy to! Login as an administrator, go to the Minify Settings page and check off “Show un-minified pages to administrators” and save the changes. Now stay logged in as an administrator in the same browser you used to change the settings and now when you view the source of a given page in the site, the source will not be minified.

I'm an advanced theme developer and I want to have different combinations of CSS or JS files on different types of pages in my theme; how is this done?

On the minify settings tab, use the drop-down selection menu to define the CSS or JS files that appear on all pages using the “Default” group first. Then specify unie files for the other pages.

Why do you set the value of the media attribute of <link> to all?

In case you were using @media declarations in your document, we’d have you covered. We will likely allow you to modify this attribute as subsequent features are finalized.

Why can't I specify other <script> types or encoding?

We have not found a use case where this appears to be of any consequence. If you’re aware of one please let us know.

Some WordPress caching plugins fail when markup is not well-formed, is this plugin similar?

No, this plugin is not similar. While valid HTML and W3C standards ensure consistent behavior across user agents and promote accessibility, any invalidity that exist in the code is not going to bring your site to its knees.

Won't various 3rd parties who's JS I download and cache be concerned?

Unlikely, you’re saving them bandwidth and using their applications, so they will probably appreciate it as long as their application still works as intended and you’re using their software in an authorized manner. Look at it this way, even before this plugin, you and thousands of other people were still downloading it, now you’re just downloading it first.

Google already minified and HTTP compressed jQuery (and other libraries ) for me, why can't I just use their bandwidth and embed other code after it?

You can! Just add Google’s script to your minify settings use non-blocking mode and your visitors will download jQuery directly from them as you wish. And the same is obviously true for any other library you wish. Remember you are creating additional DNS Lookups and HTTP transactions when you do this.

I wanted to use a different version jQuery with my theme, how do I replace WordPress' jQuery with Google's minified version using your plugin?

Currently you cannot, replacement is not yet supported.

What about query string variables on CSS and JS, do they matter?

This is definitely a special case. Files like “http://domain.com/wp-content/themes/default/js/script.js?ver=20090102″ etc need to be specified with the full URL. This is an exception to the general rule of specifying a local path to file like: “wp-content/themes/default/js/script.js”, which should also work fine. Be sure to click the “Verify URL” button to be sure that everything is ok before saving changes.

How can I embed the CSS or JS file at the location I choose?

When using Minify and JS/CSS placement, custom placement, the following tags are available:

  • <!– W3TC-include-css –>
    Used with “Auto” and “Manual”. Inserts the minified/combined CSS files at the location you choose.
  • <!– W3TC-include-js-head –>
    Used with “Auto” and “Manual”. Inserts the minified/combined JS files. Embed location “in <head>” in “Manual” mode.
  • <!– W3TC-include-js-body-start –>
    Used with “Manual”. Inserts the minified/combined JS files. Embed location “after <body>” in “Manual” mode.
  • <!– W3TC-include-js-body-end –>
    Used with “Manual”. Inserts the minified/combined JS files. Embed location “before </body>” in “Manual” mode.

What's the point of downloading and caching 3rd party files (e.g. JS)?

With the various hosted 3rd party applications available (from web site statistics to social media sharing widgets), the problems we’ve noticed are: additional HTTP transactions, DNS lookups and latencies from busy servers that we can’t control and often un-minified files with no HTTP compression all add up to a very slow page load and poor user experience. With your own copy of external files, updated as frequently as you wish, none of these problems exist.

CDN

I don't understand what a CDN has to do with caching, that's completely different, no?

Technically no, a CDN is a high performance cache that stores static assets (your theme files, media library etc) in various locations throughout the world in order to provide low latency access to them by readers in those regions.

How do I configure Amazon Simple Storage Service (Amazon S3) or Amazon CloudFront as my CDN?

First create an S3 account; it may take several hours for your account credentials to be functional. Next, you need to obtain your “Access key ID” and “Secret key” from the “Access Credentials” section of the “Security Credentials” page of “My Account.” Make sure the status is “active.” Next, make sure that “Amazon Simple Storage Service (Amazon S3)” is the selected “CDN type” on the “General Settings” tab, then save the changes. Now on the “Content Delivery Network Settings” tab enter your “Access key,” “Secret key” and enter a name (avoid special characters and spaces) for your bucket in the “Create a bucket” field by clicking the button of the same name. If using an existing bucket simply specify the bucket name in the “Bucket” field. Click the “Test S3 Upload” button and make sure that the test is successful, if not check your settings and try again. Save your settings.

Unless you wish to use CloudFront, you’re almost done, skip to the next paragraph if you’re using CloudFront. Go to the “General Settings” tab and click the “Enable” checkbox and save the settings to enable CDN functionality. Empty the cache for the changes to take effect. If preview mode is active you will need to “deploy” your changes for them to take effect.

To use CloudFront, perform all of the steps above, except select the “Amazon CloudFront” “CDN type” in the “Content Delivery Network” section of the “General Settings” tab. When creating a new bucket, the distribution ID will automatically be populated. Otherwise, proceed to the AWS Management Console and create a new distribution: select the S3 Bucket you created earlier as the “Origin,” enter a CNAME if you wish to add one or more to your DNS Zone. Make sure that “Distribution Status” is deployed and “State” is enabled. Now on “Content Delivery Network” tab of the plugin, copy the subdomain found in the AWS Management Console and enter the CNAME used for the distribution in the “CNAME” field.

You may optionally, specify up to 10 hostnames to use rather than the default hostname, doing so will improve the render performance of your site’s pages. Additional hostnames should also be specified in the settings for the distribution you’re using in the AWS Management Console.

Now go to the General tab and click the “Enable” checkbox and save the settings to enable CDN functionality and empty the cache for the changes to take effect. If preview mode is active you will need to “deploy” your changes for them to take effect.

Anything I need to do when using Amazon Web Services with limited permissions (S3, CloudFront, SNS)?

We recommend that you use IAM to create a new policy for AWS services that have limited permissions. A helpful tool: AWS Policy Generator

You also find a S3 configuration sample in the “ini” folder in the plugins directory.

How do I configure Rackspace Cloud Files as my CDN?

First create an account. Next, in the “Content Delivery Network” section of the “General Settings” tab, select Rackspace Cloud Files as the “CDN Type.” Now, in the “Configuration” section of the “Content Delivery Network” tab, enter the “Username” and “API key” associated with your account (found in the API Access section of the rackspace cloud control panel) in the respective fields. Next enter a name for the container to use (avoid special characters and spaces). If the operation is successful, the container’s ID will automatically appear in the “Replace site’s hostname with” field. You may optionally, specify the container name and container ID of an existing container if you wish. Click the “Test Cloud Files Upload” button and make sure that the test is successful, if not check your settings and try again. Save your settings. You’re now ready to export your media library, theme and any other files to the CDN.

You may optionally, specify up to 10 hostnames to use rather than the default hostname, doing so will improve the render performance of your site’s pages.

Now go to the General tab and click the “Enable” checkbox and save the settings to enable CDN functionality and empty the cache for the changes to take effect. If preview mode is active you will need to “deploy” your changes for them to take effect.

How do I use an Origin Pull (Mirror) CDN?

Login to your CDN providers control panel or account management area. Following any set up steps they provide, create a new “pull zone” or “bucket” for your site’s domain name. If there’s a set up wizard or any troubleshooting tips your provider offers, be sure to review them. In the “Content Delivery Network” tab of the plugin, enter the hostname your CDN provider provided in the “replace site’s hostname with” field. You should always do a quick check by opening a test file from the CDN hostname, e.g. http://cdn.domain.com/favicon.ico. Troubleshoot with yoru CDN provider until this test is successful.

Now go to the “General” tab and click the checkbox and save the settings to enable CDN functionality and empty the cache for the changes to take effect.

How can I host my favicon with my CDN?

If the file exists in your document root (i.e. http://domain.com/favicon.ico), the plugin can take care of that for you using custom upload options. If the file is in your theme directory you can also have the plugin uploaded from there.

What about the wp-includes files, can those be served from the CDN?

Yes, you can specify which file types you would like served by CDN and they will be uploaded and always downloaded from that location. This includes the smilies, JavaScript files et al. By default we take care of them all.

What if I don't want to work with a CDN right now, is there any other use for this feature?

Yes! You can take advantage of the pipelining support in some browsers by creating a sub-domain for the static content for your site. So you could select the “Origin Push / Self-hosted” method of the General Settings tab. Create static.domain.com on your server (and update your DNS zone) and then specify the FTP details for it in the plugin configuration panel and you’re done. If you disable the scripting options on your server you’ll find that your server will actually respond slightly faster from that sub-domain because it’s just sending files and not processing them.

Are minified files uploaded to my CDN provider?

Yes, any CSS and JS you manage with the plugin are minified before being uploaded to your CDN. You don’t have to make any special changes to your theme. We encourage you to make sure that your provider supports HTTP compression as the benefit of having your static assets available from more than one POP alone is not enough.

Who do you recommend as a CDN provider?

That depends on how you use your blog and where most of your readers read your blog (regionally). Here’s a short list:

Hang on, don't I need to modify my CSS files so they'll work on the CDN?

No, that is taken care of for you. Your CSS files will originate from your CDN provider and all paths to any images in your CSS will be changed from relative to absolute, making sure that they load just fine. Do nothing differently, yet reap all the benefits.

What is the purpose of the "Media Library Import" tool and how do I use it?

The media library import tool is for old or “messy” WordPress installations that have attachments (images etc in posts or pages) scattered about the web server or “hot linked” to 3rd party sites instead of properly using the media library.

The tool will scan your posts and pages for the cases above and copy them to your media library, update your posts to use the link addresses and produce a .htaccess file containing the list of of permanent redirects, so search engines can find the files in their new location.

You should backup your database before performing this operation.

What is the purpose of the "modify attachment URLs" button?

If the domain name of your site has changed, this tool is useful in updating your posts and pages to use the current addresses. For example, if your site used to be www.domain.com, and you decided to change it to domain.com, the result would either be many “broken” images or many unnecessary redirects (which slow down the visitor’s browsing experience). You can use this tool to correct this and similar cases. Correcting the URLs of your images also allows the plugin to do a better job of determining which images are actually hosted with the CDN

As always, it never hurts to back up your database first.

PRO version: How do I get CloudFront Dynamic Caching to work with full page caching?

To enable full page caching option you need to enable “edge mode”. If not already enabled this will
also enable Browser Cache and disable “Expires” header. This is because CloudFront does not cache properly
when “Expires” headers are set. When using CloudFront and full page caching there are no purging of cached pages when posting
new posts etc. Cache invalidations in CF is limited per month and also takes up to 15 minutes to complete.

Since there is no purging and you want to people to be able to comment it is recommended to use a hosted
commenting software, such as FaceBook Comments or Disqus. If you do not use this comments are not
shown after they been posted or approved.

Main step to get CloudFront full page caching working is to have your site on a different domain than the
one you want your visitors to see. So you should install or configure your site so its on a separate domain,
for example wp.example.com. You will then later configure example.com so its used by CloudFront.

How to configure CloudFront on AWS:

  1. Go to AWS Console
  2. Click “Create Distribution”
  3. Select “Web”
  4. Click “Continue”
  5. Enter wp.example.com into “Origin Domain Name”
  6. Enter CustomWWW-example.com into “Origin ID”
  7. Set Origin Protocol Policy to HTTP Only (CloudFront will connect to my origin using only HTTP).
  8. Select “Allow HTTP Methods” – GET, HEAD, PUT, PATCH, DELETE, OPTIONS
  9. Select “Forward Query Strings” – Yes
  10. Enter example.com (the domain that your visitors will type into their browser) into
    Alternate Domain Names(CNAMESs)
  11. Set logging to “On”
  12. Enter “webserverlog-example.com” into “Bucket for logs”
  13. Enter “stats-logs/” into Log Prefix
  14. Enter “CDN for example.com” into Comment.
  15. Click “Create Distribution”

Configure DNS

  1. Add new CNAME recored for example.com that points to the Domain Name that belongs to the distribution you created previously.

How to configure W3 Total Cache:

There are two methods to configure W3 Total Cache CDN. Origin Pull “CloudFront” or “Generic mirror”. If you want to be able to invalidate URLs from within WordPress you need to use the CloudFront option.
If you do not configure an CDN the wrong URLs will be used when linking to CSS, JS and other files.

Configure CloudFront:

  1. Select Origin Pull (Mirror) Amazon CloudPront on General Page
  2. Go to the CDN page.
  3. Enter your AWS credentials
  4. Enter example.com as an CNAME
  5. Save Settings

Configure Generic Mirror:

  1. Enter example.com into “Replace site’s hostname with:”
  2. Save Settings

Browser Cache

What's an Etag and why do I need one?

Entity tags were created to add more reliability to client side caching my providing a simple method for a browser to verify that a file had not changed since last it was downloaded. Using them helps enables your server return 304 or “not modified” responses instead of a 200 “ok” response which are much much slower (because the file is sent). The result is a visitor viewing multiple pages of your site would have that “instant loading” experience that we all definitely enjoy. Don’t worry we don’t use inodes to create our Etags so this solution is reliable for multi server hosting solutions.

What about Etags?

Yes, we have Etags covered. Even if you have a clustered hosting environment, your Etags will be consistent (across multiple servers in your cluster) so you don’t have to worry about using special session cookies when you introduce our plugin. If you would like to specify headers for various reasons, you can do that as well.

Which encodings do you support?

We recommend UTF-8, but we do not modify the encoding in any files, instead we simply return the code as it is provided.

Compatibility

Does this plugin work with WordPress MU?

Indeed it does.

Does this plugin work with BuddyPress (bbPress)?

Yes.

Which WordPress versions are supported?

To use all features in the suite, a minimum version of 2.8 is required. Earlier versions will benefit from our Media Library Importer to get them back on the upgrade path and into a CDN of their choosing.

Will the plugin interfere with other plugins or widgets?

No, on the contrary if you use the minify settings you will improve their performance by several times.

Is this plugin compatible with other popular caching plugins?

No. Any disk based page caching plugin you’re currently using would need to be completely uninstalled (not just disabled) in order to use this plugin. So if you have a development environment where you can try this out or testing during low traffic periods to get your preferences set, that is recommended. You can always backup your full WordPress installation before testing pretty quickly if you skip the /uploads/ (media library) directory.

Is this plugin comptatible with GD Star Rating?

Yes. Follow these steps:

  1. Enable dynamic loading of ratings by checking GD Star Rating -> Settings -> Features “Cache support option”
  2. If Database cache enabled in W3 Total Cache add “wp_gdsr” to “Ignored query stems” field in the Database Cache settings tab, otherwise ratings will not updated after voting
  3. Empty all caches

How do I get WPTouch to work properly together with W3 Total Cache?

You need to enable “User Agent Groups” high and low and add any user agents you think are missing.

Is this plugin comptatible with TDO Mini Forms?

Captcha and recaptcha will work fine, however you will need to prevent any pages with forms from being cached. Add the page’s URI to the “Never cache the following pages” box on the Page Cache Settings tab.

Is this plugin compatible with varnish or squid?

It is compatible with varnish.

Errors and debugging

I've been using the plugin for some time, I updated one of my other plugins and now it doesn't work anymore. What's up?

It’s likely the plugin author modified their JS or CSS in the new release and any old CSS or JS you optimized with our plugin has introduced duplicate code as a result (creating a conflict). Simply check out the source code, identify any new CSS or JS and update your CSS and JS optimizations our plugin and you’re good to go.

I see garbage characters instead of the normal web site, what's going on here?

If a theme or it’s files use the call php_flush() or function flush() that will interfere with the plugins normal operation; making the plugin send cached files before essential operations have finished. The flush() call is no longer necessary and should be removed.

I'm getting blank pages or 500 error codes when trying to upgrade on WordPress MU

First, make sure the plugin is not active (disabled) network-wide. Then make sure it’s deactivated network-wide. Now you should be able to successful upgrade without breaking your site.

My YSlow score is low because it doesn't recognize my CDN, what can I do?

Rule 2 says to use a content delivery network (CDN). The score for this rule is computed by checking the hostname of each component against the list of known CDNs. Unfortunately, the list of “known CDNs” are the ones used by Yahoo!. Most likely these are not relevant to your web site, except for potentially yui.yahooapis.com. If you want an accurate score for your web site, you can add your CDN hostnames to YSlow using Firefox’s preferences. Here are the steps to follow:

  • Go to about:config in Firefox. You’ll see the current list of preferences.
  • Right-click in the window and choose New and String to create a new string preference.
  • Enter extensions.yslow.cdnHostnames for the preference name.
  • For the string value, enter the hostname of your CDN, for example, mycdn.com. Do not use quotes. If you have multiple CDN hostnames, separate them with commas.

If you specify CDN hostnames in your preferences, they’ll be shown under the details for Rule 2 in the Performance view.

When I post / like my posts on Facebook the wrong text or no images are shown on Facebook.

If this happens you need to add the following user agents to the textarea “Rejected user agents” the Page Cache settings page:

facebookexternalhit
FacebookExternalHit/1.1
FacebookExternalHit/1.0

Also make sure you have the correct xmlns:og /xmlns:fb tags in your opening HTML tag.

Why doesn't minify work for me?

Great question. W3 Total Cache uses several open source tools to attempt to combine and optimize CSS, JavaScript and HTML etc. Unfortunately some trial and error is required on the part of developers is required to make sure that their code can be successfully minified with the various libraries W3 Total Cache supports. Even still, if developers do test their code thoroughly, they cannot be sure that interoperability with other code your site may have. This fault does not lie with any single party here, because there are thousands of plugins and theme combinations that a given site can have, there are millions of possible combinations of CSS, JavaScript etc.

A good rule of thumb is to try auto mode, work with a developer to identify the code that is not compatible and start with combine only mode (the safest optimization) and increase the optimization to the point just before functionality (JavaScript) or user interface / layout (CSS) breaks in your site.

We’re always working to make this more simple and straight forward in future releases, but this is not an undertaking we can realize on our own. When you find a plugin, theme or file that is not compatible with minification reach out to the developer and ask them either to provide a minified version with their distribution or otherwise make sure their code is minification-friendly.

The plugin tells me to add w3tc-wp-loader.php but minify loads correctly?

If you put the symlink path in w3tc-wp-loader.php the plugin will think the path has changed because WordPress converts symlinks to realpath.
You can disable the check by adding: define(‘DONOTVERIFY_WP_LOADER’, true); to wp-config.php.

A notification about file owner appears along with a FTP form, how can I resolve this?

The plugin uses WordPress FileSystem functionality to write to files. It verifies that file owner, file owner group of created files match process owner. If this is not the case it cannot write or modify files.

Typically, you should ask your web host about the permissions issue and they should be able to resolve it.
You can however try adding define(‘FS_METHOD’, ‘direct’); to wp-config.php to circumvent the file and folder checks.

I get an CloudFlare error message similar too "certificate verify locations: CAfile: /etc/path/certs/ca-bundle.crt CApath: none "

This is happens when CURL cannot find the proper location of certificates or the certificates have incorrect permissions. Ask your web host for help addressing this issue.

Extensions

PRO version: What is required for the Genesis Extension to work?

You need to enable Fragment Caching and use a theme based on Genesis.

PRO version: When I enabled Genesis Extension with EDD, WooCommerce or other similar plugins, my cart, checkout and/or other dynamic elements no longer get updated. How do I fix that?

You need to go the Genesis Extension settings page.
There you will a textbox called “Excluded single pages / posts:” there you need to enter the pages
that should not be cached by the fragment caching. The exclude textareas support regular expressions
so if the pages that are to be excluded are similar you can most likely enter one
expression that covers all your pages. For information on regular expression you need to search.

If you have anything dynamic in your widgets area, the sidebar, then you’ll need to disable the sidebar caching, or enter pages that should not have their sidedar cached.

Requirements

Which web servers do you support?

We are aware of no incompatibilities with apache 1.3+, nginx 0.7+, , IIS 5+ or litespeed 4.0.2+. If there’s a web server you feel we should be actively testing (e.g. lighttpd), we’re interested in hearing.

Do I need to enable mod_gzip, mod_rewrite or install any HTTP compression software on my server?

Not when the option is enabled for page caching or minfiied files, however you do need either module to compress files that are not handled by W3 Total Cache.

If you’re larger organization or a web hosting company, consider looking into solutions that exist like Gear6 which could be useful now that you have a plugin that makes management memcached pain free.

How much memory (RAM) do I need to delegate to caching?

Probably the hardest question of all. At the time of this writing the default WordPress install and theme will consume about 50MB of memory in an opcode cache while running our plugin. Keep in mind that the following factors will determine the minimum size of your cache beyond this noted 50MB:

  • Number of typically requested pages per day (if your blog is popular this number is quite large)
  • Size of minified CSS, JS and HTML pages (smaller is better)
  • Number and complexity of plugins active on your blog (fewer is better)
  • Expiry time of the cache (larger expiry time, larger cache)

So we recommend an absolute minimum of 128MB for a typical blog; this figure is greater than some defaults, so keep that in mind. With statistics you’ll be able to react accordingly and make adjustments.

For those that don’t want or have time to learn anything new to get started, sample configuration files are included with the plugin containing inline comments for you.

What version of PHP do I need for this thing?

Version 5.2+

What version of mySQL is needed?

If your WordPress installation works, you’re all set.

And I need mod_rewrite (or equivalent for my web server) installed too, no?

That’s correct; everything you need for WordPress (i.e. fancy URLs) will get you started with this plugin also.

How much hardware do I have to throw at something like this before I see a benefit?

This plugin was actually designed with virtual dedicated servers in mind. As long as your server has at least 256M of RAM, you can get started with the advanced optimizations.

Is this plugin server cluster and load balancer friendly?

Yes, built from the ground up with scale and current hosting paradigms in mind.

I'm a web hosting provider and I heard about this plugin from my clients, is this plugin safe for a shared hosting environment?

Yes.

What is the intended impact of this plugin on the web hosting landscape?

We feel that shared or virtual hosting providers will begin offering secure containers (similar to what mediatemple.net does for mySQL and Ruby etc) for opcode caching and memcached. Whoever brings this offering to market first will lower the bar for more web sites/applications (and startups) to build better performing applications with greater ease. The same hosting provider would also possess a new value added service, thereby realizing a competitive advantage in a highly competitive marketplace. Not to mention be able to increase the density of domains per server (or cluster) without shortchanging customers.

One day hopefully this plugin will contribute to making web servers greener and reduce the ecological footprint of the web by reducing the computational effort required to deliver high performance rich user experiences.

Developers

When are you going to translate this plugin into more languages?

When you help us! :-) Localization is tricky and we’re happy to work with those willing to support the WordPress community. We will most likely follow the trends of WordPress itself to determine which languages are addressed first.

How do I implement page fragment caching?

First you need to define W3TC_DYNAMIC_SECURITY in your wp-config.php file.

define('W3TC_DYNAMIC_SECURITY', 'somesecurestring');
                

Edit your templates with the following syntax to ensure that dynamic features remain so. Replace W3TC_DYNAMIC_SECURITY with content of the constant or use echo to print constant:

  • Example 1:
    <!– mfunc W3TC_DYNAMIC_SECURITY any PHP code –><!– /mfunc W3TC_DYNAMIC_SECURITY –>
  • Example 2:
    <!– mfunc W3TC_DYNAMIC_SECURITY –>any PHP code<!– /mfunc W3TC_DYNAMIC_SECURITY –>
  • Example 3:
    <!–MFUNC W3TC_DYNAMIC_SECURITY           –>
                                          echo rand();
    <!–/mfunc W3TC_DYNAMIC_SECURITY –>
  • Example 4:
    <!– mclude W3TC_DYNAMIC_SECURITY path/to/file.php –><!– /mclude W3TC_DYNAMIC_SECURITY –>
  • Example 5:
    <!– mclude W3TC_DYNAMIC_SECURITY –>path/to/file.php<!– /mclude W3TC_DYNAMIC_SECURITY –>

Be aware that WordPress functions will not be available.

How can I prevent caching directly in my templates etc?

Several constants are available for these purposes:

  • define(‘DONOTCACHEPAGE’, true);
    Disables page caching for a given page.
  • define(‘DONOTCACHEDB’, true);
    Disables database caching for given page.
  • define(‘DONOTMINIFY’, true);
    Disables minify for a given page.
  • define(‘DONOTCDN’, true);
    Disables content delivery network for a given page.
  • define(‘DONOTCACHEOBJECT’, true);
    Disables object cache for a given page.

How can I flush the cache without using the WP Admin interface?

It’s possible to empty the entire cache or simply purge the cache of a single post / page:

  • Purge the entire page cache:
    if (function_exists(‘w3tc_pgcache_flush’)) {
    w3tc_pgcache_flush();
    }
  • Purge a single post / page by passing it’s ID:
    if (function_exists(‘w3tc_pgcache_flush_post’)) {
    w3tc_pgcache_flush_post($post_id);
    }

How do I programmatically modify user agent groups?

There are two ways change user agent groups, functions or filter.

Using functions:

$group_config = w3tc_get_user_agent_group($group_name); //name of the group
$group_config['theme'] = 'newtheme';
$group_config['redirect'] = '';
$group_config['agents'] = array(escaped_string, [...]);
$group_config['enabled'] = true;

w3tc_save_user_agent_group($group_name, $group_config['theme'], $group_config['redirect'], $group_config['agents'], $group_config['enabled']);

			    

Using filter:

function my_w3tc_mobile_groups($w3tc_groups) {
    // any operations
    // clear all groups example
    $w3tc_groups = array();
    // delete all groups and add new example
    $w3tc_groups = array(....);
    // merge groups example:
    $w3tc_groups = array_merge($w3tc_groups, array(
        'good_browsers' => array(
                    'theme' => 'good_theme/good_theme',
                    'enabled' => true,
                    'redirect' => '',
                    'agents' => array('firefox', 'chrome')
                    ),
        'bad_browsers' => array(
                    'theme' => 'bad_theme/bad_theme',
                    'enabled' => true,
                    'redirect' => '',
                    'agents' => array('msie', 'opera')
                    )
    ));
    return $w3tc_groups;
}
add_filter('w3tc_mobile_groups', 'my_w3tc_mobile_groups');
				

How do I programmatically modify referrer groups?

There are two ways change referrer groups, functions or filter.

Using functions:

$group_config = w3tc_get_referrer_group($group_name); //name of the group
$group_config['theme'] = 'newtheme';
$group_config['redirect'] = '';
$group_config['referrers'] = array(escaped_string, [...]);
$group_config['enabled'] = true;
w3tc_save_referrer_group($group_name, $group_config['theme'], $group_config['referrer'], $group_config['referrers'], $group_config['enabled']);
			    

Using filters:

function my_w3tc_referrer_groups($w3tc_groups) {
// any operations // clear all groups example $w3tc_groups = array(); // delete all groups and add new example $w3tc_groups = array(....); // merge groups example: $w3tc_groups = array_merge($w3tc_groups, array( 'search_referrers' => array( 'theme' => 'search_theme', 'enabled' => true,
'redirect' => '',
'referrers' => array('google\.com') ), 'other_referrers' => array( 'theme' => 'video_theme', 'enabled' => true, 'redirect' => '', 'referrers' => array('youtube\.com') ) )); return $w3tc_groups; } add_filter('w3tc_referrer_groups', 'my_w3tc_referrer_groups');

How do I remove the W3 Total Cache HTML comment?

Define APP_REQUEST in wp-config.php for example:

if ($_SERVER['REQUEST_URI'] == ‘/my-specific-page/’) {
    define(‘APP_REQUEST’, ‘true’);
}

How can I make w3tc-wp-loader.php work correctly with symlinks where the real path changes from time to time?

Add the symlink path to w3tc-wp-loader.php and then disable the wp loader check by adding: define(‘DONOTVERIFY_WP_LOADER’, true); to wp-config.php.

How can I issue delete and reload APC commands over HTTP/WP-CLI?

Functions required for deleting and reloading over HTTP is found in inc/functions/plugin.php.
Call w3tc_apc_reload_files(array(‘file1′ …),true) to reload files.
Call w3tc_apc_delete_files_based_on_regex(‘a regular expression’, true) to delete files.

To do it locally with WP-CLI:
Call wp w3-total-cache apc_reload_files local file1 file2 file3
Call wp w3-total-cache apc_delete_based_on_regex local regex

How do I add new extensions?

Refer to w3-total-cache/extensions/GenesisAdmin.php to see how to create an extension by example.

// Adding a basic function. See GenesisAdmin.php for how to setup settings screen.
add_filter('w3tc_extensions', 'custom_extension');
function custom_extension($extensions) {
        $extensions['some.theme'] = array (
            'name' => 'Custpom Framework Extension',
            'author' => 'Bluw Widgets',
            'description' => 'Adds specific caching capabilities.',
            'author uri' => 'http://example.com',
            'extension uri' => 'http://example.com',
            'extension id' => 'some.theme',
            'version' => '0.1',
            'enabled' => true,
            'requirements' => array(),
            'path' => 'your-plugin-folder/extensions/CustomExtension.php'
        );
}

PRO version: How do I implement fragment caching?

Fragment caching adds new functionality to the WordPress Transients API:

  • Adds support for grouping transients both per blog and site wide
  • Adds support for manual flushing of registered transient groups
  • Adds support for action based flushing of registered transient groups
  • Adds support for caching filters and actions

To make the plugin aware that you group transients see code examples below:

add_action('w3tc_register_fragment_groups', 'my_plugin_register_groups');

function my_plugin_register_groups() {
	//blog specific group and an array of actions that will trigger a flush of the group
	w3tc_register_fragment_group('my_plugin_', array('publish_post'), 3600);
	//If using MultiSite Network/site wide specific group and an array of actions that will trigger a flush of the group
	w3tc_register_fragment_group_global('my_plugin_global_', array('edit_site'), 3600);
}
function my_plugin_flush_group() {
	//manually flush a blog specific group.
	w3tc_fragmentcache_flush_group('my_plugin_');
}
function my_plugin_flush_global_group() {
	//manually flush a network wide group
	w3tc_fragmentcache_flush_group('my_plugin_global_', true);
}

//Set transients
function on_some_event() {
    if (false === get_transient('my_plugin_some_key'))
        //my_plugin_ prefix is the group name we registered earlier
        set_transient('my_plugin_some_key', 'blog specific value');
    if (false === get_site_transient('my_plugin_some_key'))
        //my_plugin_site_ prefix is the group name we registered earlier
        set_site_transient('my_plugin_site_some_key', 'site wide specific value');
}

// Cache action example
add_action('theme_post_loop', 'cache_theme_post_loop_start',-999999999);
add_action('theme_post_loop', 'cache_theme_post_loop_end', 999999999);

/**
 * Start outputbuffering
 */
function cache_theme_post_loop_start() {
    w3tc_fragmentcache_start('example1', 'examples', 'theme_post_loop');
}

/**
 * Store the output buffer .
 */
function cache_theme_post_loop_end() {
    w3tc_fragmentcache_end('example1', 'examples', false);
}

// Cache filter example
add_filter('theme_filter', 'cache_theme_filter_start',-999999999);
add_filter('theme_filter', 'cache_theme_filter_end', 999999999);
/**
 * Start filter buffering and return filter result
 */
function cache_theme_filter_start($data) {
    return w3tc_fragmentcache_filter_start('example_filter1', 'examples', $hook, $data);
}

/**
 * Store the filter result and return filter result.
 */
function cache_theme_filter_end($data) {
    return w3tc_fragmentcache_filter_end('example_filter1', 'examples', $data);
}
	

0.9.4

  • Fixed undefined w3tc_button_link
  • Fixed support and other form submissions
  • Fixed extension enabled key error
  • Fixed Test CDN errors
  • Fixed trailing slashes in custom wp content path and Minify
  • Fixed WP_PLUGIN_DIR not being available when object-cache.php is loaded and W3TC constant not set
  • Fixed Minify Auto and restructuring of JS code placement on page
  • Fixed remove / replace drop in file on plugins page
  • Fixed false positive check for legacy code
  • Fixed deprecated wpdb escape
  • Fixed Fragment Caching and APC anomalies
  • Fixed cached configs causing 500 error on interrupted file writes
  • Fixed readfile errors on servers with the functionality disabled
  • Fixed false positives for license key verification
  • Fixed debug information not printed on cached pages
  • Fixed backwards compatibility and flushing and added doing it wrong notification
  • Fixed "Prevent caching of objects after settings change"
  • Fixed "Use late init" being shown as enabled with Disc:Enhanced
  • Fixed missing param in APC cache method declaration
  • Fixed user roles property not begin an array
  • Fixed adding empty Vary header
  • Fixed notice on failed upgrade licencing check
  • Fixed Database Cache description text
  • Fixed duplicate bb10 agents
  • Fixed settings link in Minify Auto notification
  • Fixed notice with undefined constant
  • Fixed nginx configuration and Referrer, User Groups setting
  • Fixed Genesis settings and Suhosin field name limit error
  • Fixed Genesis and Fragment Caching (caching categories etc)
  • Fixed CDN being enabled when creating NetDNA/MaxCDN pullzone
  • Fixed NewRelic related notice in compatibility popup
  • Fixed trailing slash issue in filename to url conversion
  • Fixed issue with wp in subdirectory and relative Minimal Manual urls
  • Fixed issue with widget styling
  • Fixed issue with Purge All button action
  • Fixed issue with exporting of settings
  • Fixed issue with plugin interferring with preview theme
  • Fixed issue with malformed config files
  • Added caching of list of posts pages (tags, categories etc) to Genesis extension a long with flush it checkbox
  • Added typecasting on expiration time in object cache drop-in
  • Added capability check for save options
  • Added FeedBurner extension
  • Added woff support to Browser Cache
  • Added new CloudFlare IPs
  • Added support for WordPress defined charset and collate in CDN queue table creation
  • Added WordPress SEO by Yoast extension
  • Added *.less to CDN theme uploads and MIME
  • Added default settings for MaxCDN Pull Zone creation
  • Added call to change MaxCDN canonical header setting to match plugin setting
  • Added one button default pull zone creation to MaxCDN without refresh
  • Added MaxCDN authorization validation
  • Added whitelist IPs notification for MaxCDN
  • Added support for use of existing zones without refresh
  • Added new mime types
  • Added support for separate domains for frontend and admin backend
  • Added CloudFlare as an extension
  • Added nofollow to blogroll links
  • Added DEV mode support to PRO version
  • Added EDGE MODE functionality
  • Improved wrapper functions in plugins.php for plugin / theme authors
  • Improved reliability of NetDNA / MaxCDN API calls by using WP HTTP and not cURL
  • Improved Fragment Caching debug information
  • Improved preview mode, removed query string requirement
  • Improved FAQ structure
  • Improved empty minify/pgcache cache notification when using CDN
  • Improved default settings for MaxCDN zone creation
  • Improved CDN queue performance
  • Improved blogmap url sanitation
  • Improved MaxCDN automatic zone creation process
  • Improved license key saving and Pro mode activation on Pro license purchases
  • Updated EDGE MODE: Full site mirroring support for MaxCDN
  • Updated translations

0.9.3

  • Added support for extensions
  • Added support for WordPress SEO image filter and CDN
  • Added file exclusions for media query string logic
  • Added user agents to user agents groups
  • Added CDN FTP path / host test
  • Fixed object cache and database cache for localization plugins
  • Fixed chinese filenames when using CDN
  • Fixed removal of stale cached files
  • Fixed missing slashes in inline HTML, JS and CSS files when using CDN
  • Fixed auto mode of minify filename length test
  • Fixed NetDNA / MaxCDN testing when domain does not match domain zone settings
  • Fixed CurlException and NetDNA / MaxCDN
  • Fixed pull zone dropdown not showing or showing wrong zone
  • Fixed trailing slash and redirect with apache
  • Fixed false notification for page cache rules verification
  • Fixed duplicate notifications for FTP
  • Fixed empty FTP form
  • Fixed add-in file validation
  • Fixed browser cache headers for proxy cases
  • Fixed wrong slash in Minify filepaths on windows based sites
  • Fixed settings link in minify test failure and multisite
  • Fixed missing param in canonical link generation
  • Fixed PHP 5.2 compatibility
  • Fixed handling of minify in preview mode
  • Fixed order of operation issue on install tab for nginx
  • Fixed translatable strings handling
  • Fixed page cache debug mode issues
  • Fixed home URL handling in multisite
  • Fixed manual minify mode and path based file source for sub-directory installations
  • Fixed path not set in disk enhanced caching
  • Fixed page cache rewrite rule detection
  • Improved security with esc_usage
  • Improved backend performance with extensive refactoring