Caching with Leaky Paywall (i.e WP Engine)
Leaky Paywall can/will work with hosts that cache heavily:
- WPEngine
- Flywheel
- Pagely
- SiteGround
- Pressable
AND caching plugins (like WP Super Cache, WP Rocket, etc), but it all depends on how it’s setup. Any caching plugin you use will have a lot of different setup options, and the sort of plugins you’re using (WooCommerce, iThemes Exchange, Leaky Paywall, etc) will often times determine what kinds of caching you should be using. Any sort of caching that simply caches the HTML output of a page is pretty basic and often has problems. The best caching to use with any sort of membership management sites like Leaky Paywall is backend object caching.
If your host caches heavily or you use a caching plugin you may need to use the alternative (javascript) caching method.
1. Enable “Alternative Subscription Handling”
In Leaky Paywall > Settings > Subscriptions click the “Alternative Subscription Handling” checkbox to enable it.
2. Set the post and page container selectors
By default Leaky Paywall uses the CSS selector "article .entry-content" to determine where your content lives on the screen. If your theme uses a different CSS selector, enter it here. You can enter a different selector for posts and pages in case your theme uses different selectors for each type of content.
You can use your browser's inspector to find the selector that contains your post content. Since themes are different you will need to find your specific article container. Here's how to find it:
- Go to an article page
- In your browser menu choose View/Developer/Inspect Elements (or similar depending on your browser)
- Highlight some text that should be near where the subscription nag would display (near the end of your excerpt text)
- Right click on on the highlighted text and choose Inspect
- In the inspector window you will need to find the container that contains your content. Ex: td-post-content (it should be close to the highlighted line)
- In the screenshot below the correct value to use for the post container selector is ".entry-content" (note the period in front of the name)
- When you find the post container name you need to add a "." in front of the container name. In the example below, the correct value to use for the post container selector is ".td-post-content"
- Add the container name to the Leaky Paywall Post Container fields
- That should do it. Test access to make sure restrictions are working properly
3. Set the number of Lead In Elements
Set the number of HTML elements (paragraphs, images, etc.) to show before displaying the subscribe nag.
4. Make sure your theme is using the body_class() function
WordPress themes should use the body_class() function to add default WordPress classes to the <body> tag of your site. This is standard on almost every WordPress theme and is required for Leaky Paywall to work. It will look like this in your theme:
<body <?php body_class(); ?>>
For more information, please see https://developer.wordpress.org/reference/functions/body_class/
5. If it's still not working with WP Engine, disable the cookie from caching on live site
Ask WP Engine support to “disable this cookie from caching on live site”:
For single site: issuem_lp
For multisite: issuem_lp_<site id>
You may also need to whitelist certain URLs, for instance, if you’re using the IssueM plugin, you could white list this URL:
http://example.com/article/*
We use Nginx, PHP-FPM, and Redis caching on our sites and have never had any trouble with any e-commerce or membership solution.
We have also seen success with the Fastest Cache plugin.