Caching is a way to speed up your website load time. With caching, a rendered version of some or all of the page is saved on your web server. When someone visits your site, the cached version is loaded instead of generating the entire page each time.

How is caching done?

There are many different plugin-based and web host-based solutions for caching.

While the technology beneath the various solutions can be different, they are similar enough so that the advice below should be applicable to any caching based system being used.

Other technologies that might be in use on your hosting environment:

  • Varnish
  • Redis
  • Memcached
  • Endurance Caching
  • SiteGround Optimizer

There are many others not listed above, as well as third party services including CloudFlare and Content Deliver Networks (CDNs) like MaxCDN that result in a complicated landscape of options. The advice below is meant to be general so it can be used across the various options.

Video: Setting Up W3 Total Cache Tutorial

Caching is a good thing, but…

It’s important to consider four main issues that caching can cause on a membership website running Paid Memberships Pro.

  1. Caching of the checkout pages can interfere with the core gateway code and many add ons used to customize the checkout experience.
  2. Caching of protected “members only” content can result in the cached content being seen by non-members (or members being unable to see protected content).
  3. Caching of callback scripts used by the gateways (IPN hanlders and web hooks, etc) can cause orders and cancellations to break or not be tracked properly.
  4. Sites that are heavily cached may not trigger the “WP Cron”, causing issues with member expiration and other cron jobs run by WordPress and other plugins. For more information on troubleshooting cron issues see our guide here.

General Advice for Caching with PMPro

There are three corresponding pieces we advise on when setting up a caching system on a membership website. This applies mostly to “page caching” techniques, but can be generalized to other partial caches.

Exclude all PMPro-generated pages and your Log In and Password Reset pages from your cache. Specifically, be sure to exclude the checkout and confirmation pages.

In W3 Total Cache, you can add the following rule to “Never cache the following pages” box on the page cache settings:

This will block the /membership-account/ page and all pages under it, like /membership-account/membership-checkout/. If you are not using pretty permalinks or not using the default page names for the PMPro pages, you should add the slugs/URLs for your specific setup.

Disable caching for logged in users or exclude caching on all member-protected content.

In W3 Total Cache, you would check the “Don’t cache pages for logged in users” option in the page cache settings. This way page caches will be built showing the non-member view of a page (with link to register/etc) and when members sign in, they will see a non-cached member version of the page.

Disable caching for the “web hook” or “IPN URL” used by your gateway.

If the gateway you chose has a web hook or IPN URL, it will be shown at the bottom of the PMPro Payment Settings page. Make sure this URL is not cached by your system. Some hosts (especially shared hosting setups) may have additional caching of this URL only for IP addresses that hit the URL often (i.e. the gateways, but not when you navigate to the URL yourself). So it may not appear cached to you but will be cached when the gateway hits it causing problems. Your gateway will typically show these errors to you and you may be able to get it fixed by opening a support ticket with your host and explaining the situation.

Disable Endurance Caching:

Set “Endurance Caching” to “Off (Level 0)” from the list to stop the Endurance Cache. Endurance Caching does not provide a way to exclude pages from caching.

Configure SiteGround Optimizer:

If you are hosted with SiteGround, refer to these docs for how to properly configure their required caching plugin.

The Cost of Not Caching

These 3 steps are costly. A non-cached checkout page will function slower than a cached one and slower checkout pages will have lower conversion rates. Sometimes you can get away with caching the checkout page (be sure to test), but a slower but functional checkout page is going to be better than a fast but broken checkout page.

In general, a membership site is more complicated than a static website/blog and requires more “horsepower” in your hosting. If you find your site running slowly, you can upgrade your hosting/server/hardware to get more horsepower. It is still a good idea to cache pages you can cache because using the cache will lower the total load on your server and so even non-cached pages will perform a bit better.

The 3 recommendation above are a kind of general brute force fix to issues that come up when caching. There are some more subtle solutions that will allow you to get benefit from caching on your checkout and members only pages. However, these solutions will take a good amount of custom development and configuration to setup.

Object Caching

Object caching is something you can configure for your entire WordPress site. It’s not something that we do inside of our plugin specifically.

However, if you change level restrictions for a post or update the category restrictions for a level, or make many other restriction settings, you may need to manually clear the object cache to make sure your site functions as intended.

Tactics to Cache Member Pages

So far everyone we’ve talked to about implementing some of these solutions has instead chosen to spend more money on faster hosting, but in theory these methods could be used to get more performance out of less hardware. Membership sites with 100k+ members and/or 250k+ visitors per month may need some of these updates to function as fast as possible.

  1. Partial Caching

    Cache the “frame” HTML/etc of your website and load them statically, but load other parts of your pages (Welcome, Jason) dynamically.

  2. Store a non-member and member version of each page in cache

    Cookies can be used to check if a user is logged in and a member before serving them the cached member page.

  3. Use JavaScript to load member content

    Load a static non-member version of a page from cache, then load the member content via JavaScript.

These and other methods can be used to get caching working with PMPro. If you’d like some help talking through these options for a specific setup, please reach out to our support team.

Was this article helpful?
YesNo