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, and /register. In addition, MemberPress uses the /unauthorized slug 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.
So, here they are, in alphabetical order:
Breeze
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.
Comet Cache
Navigate to Comet Cache -> URI Exclusions and then add /thank-you**, /account**, /login**, /register** /unauthorized** and /mepr** to the text box. Each is 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:
FlyingPress
Navigate to the Cache section and ensure 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 the caching textbox.
When done, click the blue Save changes button.
Hummingbird
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:
Hyper Cache
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 a text box. Each is 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
Kinsta Cache is, by default, installed and activated on all Kinsta hosting plans.
They used to have a plugin that controlled the cache behaviors, 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.
LiteSpeed Cache
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 -> [1] Cache tab and make sure that the Cache Logged-in Users [*] and Cache Login Page options are set to OFF. Click the Save Changes button in the top right corner before moving to another tab.
Navigate to LiteSpeed Cache -> Settings -> [4] Excludes tab, Do Not Cache URIs section. After that, add /thank-you/, /account/, /login/, /register/, /unauthorized/, and /mepr/ to the text box. Each is in its own row. When done, click the Save Changes button. The final result should look like this:
Navigate to LiteSpeed Cache -> Settings -> [6] Object tab and ensure 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.
Nitropack
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:
*thank-you*
*account*
*login*
*register*
*unathorized*
*mepr*
When done, click Save on the top right.
Speed Optimizer
Speed Optimizer (previously SG Optimizer) is, by default, installed and activated when you buy any SiteGround shared hosting plan.
Navigate to Speed 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 change the default MemberPress page URIs, you must use those instead of the first four entries.
Please note that some SiteGround servers continue caching Stripe webhook and PayPal IPN URLs even after all the exclusions are set up correctly. In a case like that, the additional exclusion will have to be done through the .htaccess file as outlined in https://eu.siteground.com/kb/disable-dynamic-caching-website/#Exclude_a_single_page_from_the_cache document.
The additional code will look like this (for Stripe):
<If "%{THE_REQUEST} =~ m#/mepr/notify/xxxxx-xxx/whk#"> <IfModule mod_headers.c> Header set Cache-Control "private" </IfModule> </If>
You'll need to replace the /mepr/notify/xxxxx-xxx/whk with the actual webhook whose URL you can get from https://dashboard.stripe.com/webhooks page. PayPal's IPN URL is visible from the MemberPress>Settings>Payments tab.
Since a malformed .htaccess file can bring your website down, if you don't feel comfortable doing this on your own, please ask SiteGround support to assist you.
Sucuri Firewall (and cache)
The Sucuri Firewall plugin contains a 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 the 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 (a member would be logged in, but would have access to only a fraction of the protected content), you might need to add a 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:
WP-Optimize
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 is 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:
WP Rocket
This plugin is one of the two that can have caching enabled for logged-in users. That's because it creates completely separate caching sessions for every user. Thus, cached files will not be accessible between different logged-in users.
Navigate to Settings > WP Rocket > Add-ons > User Cache section and activate the add-on if it is not already active:
Then, navigate to Settings > WP Rocket > Advanced Rules tab and add /thank-you/(.*), /account/(.*), /login/(.*), /register/(.*), /unauthorized/(.*) and /mepr/(.*) to the text box. Each is 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 is 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
Please note that all of the plugins listed above contain many more options and features than presented here. Things like minification and caching of HTML, CSS, and JavaScript files, removal of query strings, Gzip compression, and many others. Those usually do not affect MemberPress and will not be covered here.
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.