How to Set Up Popular Caching Plugins with MemberPress?
Everyone wants their websites to load as fast as possible, and even Google gives an advantage to the faster-loading websites in the search results.
The easy way to achieve that in WordPress is to install one of many available caching plugins. However, due to the dynamic nature of MemberPress, installing a caching plugin without setting it up properly can cause some unwanted consequences. The most serious one is the inability to process transactions appropriately, which can cause financial losses to the website owners.
That's why we've decided to list the most popular caching plugins and show how to set them up properly.
All the settings are based on MemberPress defaults for Thank You, Account, Login, and Registration pages, as shown in this image:
The default slugs are: /thank-you, /account, /login, /register plus /unauthorized for handling unauthorized access redirects and /mepr for the internal operations of Webhooks, PayPal IPN URL, etc. If you change any of the first four, or if you add your own registration pages made in some page builder, you'll need to adjust the slugs and URLs accordingly.
If you are using the MemberPress Downloads add-on, you will also need to add /mpdl to the exclusions.
So, here they are, in alphabetical order:
Navigate to the Settings -> Breeze section of your WordPress Dashboard. Then add full URLs of your Thank You, Account and Login pages and partial URLs for Register, mepr and unauthorized pages. Finish all of them with (.*) as shown on the screenshot below, in the Advanced Options section:
When done, don't forget to click the blue Save Changes button at the bottom.
Breeze plugin often comes preloaded with Cloudways hosting. If that's the case, you'll also have to exclude the same URLs from their Varnish cache if enabled. Please refer to https://support.cloudways.com/en/articles/5496342-how-to-use-varnish-at-cloudways#h_4f3846fd10 to see how to do it correctly.
Navigate to Comet Cache -> URI Exclusions and then add /thank-you**, /account**, /login**, /register** /unauthorized** and /mepr** to the text box. Each in its own row. Scroll to the bottom of the page and click the green Save All Changes button. The final result should look like this:
If you're going to use CDN that's built-in in the Pro version, you'd need to add the same to the Blocked URI Exclusion Patterns text box, located in the Static CDN Filters section, like this:
Navigate to the Cache section and first make sure that the Cache logged in users option is not checked. Then add /thank-you, /account, /login, /register, /mepr and /unauthorized to the Exclude pages from caching textbox.
When done, click the blue Save changes button.
Navigate to the Hummingbird -> Cache section of your WordPress Dashboard. Then scroll down the page to the Exclusions text box. Enter /thank-you/, /account/, /login/, /register/, /mepr/ and /unauthorized/ in the box, each in its own row. When done, please click the blue Save Settings button at the bottom right. The final result will look like this:
Navigate to Settings -> Hyper Cache -> Bypasses tab, and then add /thank-you, /account, /login, /register, /unauthorized and /mepr to the Do not cache pages with URIs starting with text box. Each in its own row. Do not forget to click the Enable checkbox. Scroll to the bottom of the page and click the blue Save button. The final result should look like this:
Kinsta Cache is, by default, installed and activated on all Kinsta hosting plans.
They used to have a plugin that controlled the cache behaviours, but it was discontinued after they changed the way caching was implemented. In order to exclude MemberPress pages from caching, please contact their support team and ask for "/thank-you", "/account", "/login", "/register", "/mepr" and "/unauthorized" URLs and all of its variations to be excluded from caching. Once done, please purge the cache from the WordPress dashboard.
If you have changed the defaults offered by MemberPress in the Pages tab, you'll have to adjust URLs to reflect those used in your case.
The LiteSpeed Cache plugin usually comes preinstalled and activated with every LiteSpeed-based hosting when you install WordPress. If not, it can be downloaded from here.
First, navigate to LiteSpeed Cache -> Settings ->  Cache tab and make sure that Cache Logged-in Users [*] and Cache Login Page are set to OFF. Click the Save Changes button in the top right corner before moving to another tab.
NOTE: We have reports from our customers that you can leave this feature set to ON and that it doesn't cause any issues.
Navigate to LiteSpeed Cache -> Settings ->  Excludes tab, Do Not Cache URIs section. After that, add /thank-you/, /account/, /login/, /register/, /unauthorized/ and /mepr/ to the text box. Each in its own row. When done, click the Save Changes button. The final result should look like this:
Please don't forget to adjust your URIs if you have changed the default ones offered by MemberPress, and also add any custom registration and "thank you" pages that you have created using MemberPress shortcodes.
Navigate to LiteSpeed Cache -> Settings ->  Object tab and make sure that the Object Cache is OFF.
You can find more details about other LiteSpeed Cache options on the Beginner's Guide to LiteSpeed Cache for WordPress page.
Navigate to General Settings, then locate the box Excluded URLs and enable the option (click the toggle on the right).
Then enter these URLs as shown:
When done, click Save on the top right.
SG Optimizer is, by default, installed and activated when you buy any SiteGround shared hosting plan.
Navigate to SG Optimizer -> Caching and first ensure that the Memcached is disabled. After that, scroll further down the page, and click the "Pencil" button in the Exclude URLs from Caching section. Then add thank-you*, account*, login*, register*, unauthorized*, and mepr* one by one by clicking the "Plus" button in the Exclude URLs from Caching section and clicking the blue Confirm button when done. The final result should look like this:
If you changed the defaults offered by MemberPress, you'll have to use those instead the first four entries.
Sucuri Firewall (and cache)
Sucuri Firewall plugin contains caching part too as a paid feature or as a part of Sucuri hosting.
On the Performance tab, select Site caching (using your site headers).
Then click the Non-Cache URLs section. There, just add the full address of the directory or pages you want to avoid caching. You'd need to add /thank-you, /account, /login, /register, /unauthorized and /mepr. Click Add URL button after every entry.
Before saving, select the Clear cache too (optional) checkbox.
W3 Total Cache
Please do not enable Database Cache and Object Cache on the Performance -> General Settings page.
Instead, navigate to Performance -> Page Cache -> General and make sure that the option Don't cache pages for logged in users is checked.
Navigate to Performance -> Page Cache -> Never cache the following pages and add /thank-you*, /account*, /login*, /register*, /unauthorized* and /mepr* to the text box. Each in its own row. Scroll to the bottom of the page and click the blue Save Settings & Purge Caches button. The final result should look like this:
WP Fastest Cache
Navigate to WP Fastest Cache -> Settings tab and make sure that the Don't show the cached version for logged-in users option is enabled:
Navigate to WP Fastest cache -> Exclude tab. Click the grey Add New Rule button and add the thank-you, account, login, register, unauthorized and mepr as Starts With URIs:
Click the green Save button to add those URIs one by one. The final result should look like this:
If you experience an issue where the unauthorized page(s) with the login form would just refresh after entering login credentials (while a member would actually be logged in but would have access to only a fraction of the protected content), you might need to add an additional rule of the " Contains:" category, which would prevent caching of those pages. What part of the URL the rule would be based upon depends on the actual URL. So if those pages would contain "-members" in the URL, you could target that string.
The final result would look like this:
Navigate to WP-Optimize -> Settings -> Cache -> Page cache tab and make sure that the option Serve cached pages to logged in users is disabled:
Navigate to WP-Optimize -> Settings -> Cache -> Advanced settings tab and add /thank-you/*, /account/*, /login/*, /register/*, /unauthorized/* and /mepr/* to the text box. Each in its own row. Scroll to the bottom of the page and click the blue Save changes button. The final result should look like this:
Navigate to Settings -> WP Rocket -> Cache tab -> User Cache section and make sure that Enable caching for logged-in WordPress users option is disabled:
Navigate to Settings -> WP Rocket -> Advanced Rules tab and add /thank-you/(.*), /account/(.*), /login/(.*), /register/(.*), /unauthorized/(.*) and /mepr/(.*) to the text box. Each in its own row. Scroll to the bottom of the page and click the orange Save Changes button. The final result should look like this:
If you're going to use the CDN, you should do the same on the CDN tab:
WP Super Cache
Navigate to Settings -> WP Super Cache ->Advanced tab and make sure that Disable caching for logged in visitors. (Recommended) is set:
Navigate to Settings -> WP Super Cache -> Advanced tab. Scroll down the page and add /thank-you/, /account/, /login/, /register/, /unauthorized/ and /mepr/ to the Reject URL Strings text box. Each in its own row. After you add all of them click the blue Save Strings button. The final result should look like this:
If you activate the built-in Simple CDN, then you'll also need to go to the CDN tab and add thank-you, account, login, register, unauthorized, mepr, exactly as shown, to the Exclude if substring field, like this:
Instead of conclusion
You can use the GTMetrix website to fine-tune your caching plugin and make your website as fast as possible without breaking it in the process.