This quick tutorial explains how to exclude USP Forms from the W3 Total Cache plugin. Excluding the pages that are displaying your forms can help resolve certain issues like the “please do not load this page directly” error. In general, dynamic content like forms should not be cached because it can interfere with normal functionality. Here is an example of the type of error that is associated with cache-related issues:
Please do not load this page directly. Thanks!
For users of W3 Total Cache, here is the solution. Note that this is a general technique that should work in any decent cache plugin.
To exclude all USP Forms from getting cached, visit the W3 Total Cache setting, Page Cache ▸ Never cache the following pages. There you should find something similar to the default value for this setting:
Along with any other patterns that have been added.
Now add the following patterns to exclude all USP Forms:
That will exclude all USP Forms when they are accessed directly via their permalink URLs. For example:
Most likely, however, you are not displaying the forms directly via their permalink URLs, but rather using the USP Form Shortcode to display your forms on any WP Post or Page. So in that case, you will want to add the URLs of whichever posts and/or pages that display the forms.
For example, if you are displaying a post-submission form on a page called “Submit”, the URL of that page might be something like:
So you would return to the W3 Total Cache exclude setting, and add the following line:
Likewise, you would repeat this for any other URLs at which USP Forms are displayed.
That’s all there is to it. Once you’ve added your patterns, the W3 exclude setting should look something like this:
So you have your added patterns included along with the default patterns. In other words, don’t delete the default patterns or any other existing exclusions.
Taking a few moments to exclude USP Forms from getting cached is a great way to ensure that caching does not interfere with normal functionality.