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.

Step 1

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:

wp-.*\.php
index\.php

Along with any other patterns that have been added.

Step 2

Now add the following patterns to exclude all USP Forms:

/usp_form/.*

That will exclude all USP Forms when they are accessed directly via their permalink URLs. For example:

http://example.com/usp_form/submit/
http://example.com/usp_form/contact/
http://example.com/usp_form/register/

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:

http://example.com/submit/

So you would return to the W3 Total Cache exclude setting, and add the following line:

/submit/.*

Likewise, you would repeat this for any other URLs at which USP Forms are displayed.

Done.

That’s all there is to it. Once you’ve added your patterns, the W3 exclude setting should look something like this:

wp-.*\.php
index\.php
/submit/.*
/usp_form/.*

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.