All headers have no-cache and cache-control: max-age=0

Lately my site has been setting no-cache and cache-control: max-age=0 on the header of every page, even pages without s2member conditionals. When I disable S2’s framework, the problem goes away.

Does anyone have any ideas on how to prevent this?

I’m experiencing the same issue. I’d love to hear a solution for fixing this.

I’m still running into this issue. Lately I have been trying to figure out a solution with my host (Flywheel) and some experts from Codeable, but they keep pointing me back here to ask for support/solutions from s2member.

Here’s exactly what’s going on. Does anyone have any insight for how I can fix this problem?

The issue is actually stemming from the plugin S2 member adding the pragma: no-cache heading to every page, whether there is a member logged in or not. For example, here are the headers for the Homepage.

This is causing the page to load without cache. I recommend reaching out to the plugin developer for further insight into why this header is being delivered even when logged out and what the best workaround is.

have you set lazy loading in general options - to only when absolutely necessary? That should solve it.

1 Like

s2Member sets no-cache when a page has dynamic content like an s2 shortcode (e.g. s2If).

Here’s something you can try, create this file: /wp-content/mu-plugins/s2-cache.php

<?php

if (!defined('ABSPATH')) {
    exit;
}

add_filter('ws_plugin__s2member_no_cache_headers_selective', '__return_true');

Let me know if that helps.

:slight_smile:

1 Like

I worked on this the last couple of days. Please check out the beta below.

It adds a new setting here: WP Admin > s2Member > General Options > Performance & Caching > No-Cache Headers Behavior (beta)

Please let me know how it goes after you try it.

:slight_smile:

s2member-v260309.5031.zip (1.4 MB)

1 Like

:slight_smile:

1 Like

Thanks so much @openmtbmap and @clavaque - I really appreciate it!

I’m going to send this information to my developer today. I’ll report back with results.

1 Like

I hope it helps! I look forward to your update. :slight_smile: