Can't use any cache plugin

Upon activating Membership 2, the caching stopped. I also activated network protection in wp-config.
I thought I had all plugin problems sorted out especially by going multisite - and now I can't get any caching plugin to work. Tried WP Super Cache, W3, Cachify, Comet Cache (did the best job but still slow).

  • Patrick

    This is a follow-up from our LiveChat session today:

    After this issue first appeared, Membership 2 had been set up on a per-site basis, and things were working fine. However, it is occurring again following latest updates to WP-Super-Cache.

    When M2 is active on the site, page cache appears to be adversely affected, slowing page-load time to the point where it would appear cache is simply not working at all.

    There are no errors or warnings in console. So the only clues we really have are in the dev logs for the cache plugin: https://plugins.trac.wordpress.org/log/wp-super-cache/trunk?rev=1703450

    Peter has granted support access, and provided additional login creds if needed (see note in Relevant Chat link)

  • Peter

    Hi Ivan,

    looks like there is some confusion after all

    First time around the problem with WP Super Cache was caused by network protection through Membership 2 Pro (MS_PROTECT_NETWORK). Restructuring the multisite environment I was able to live without network protection so I worked around the bug which was never resolved.

    Now after a little vacation break and several updates to Super Cache later the problem returned. This time even without MS_PROTECT_NETWORK=true.

    I am quite happy with the server speed so I assume you only clicked on standard pages where you wouldn't really notice the speed difference all that much.
    Good indicator of course is Super Cache's self test. After (de)activating plugins it seems you need to delete the cache first before you will see difference in behaviour reliably.
    Also if you click on "Buchtipps" in the main menu. There's tons of data and probably more important shitloads of db queries behind that without caching. Pingdom clocks the page load time to around 10 sec without cache and apprx. 1.5 sec with cache working. 10 sec is not an option so I really need to find a fix for that problem.

    Cheers,
    Peter

  • Peter

    Hi Ivan,

    yes. That's the one.

    If WP Super Cache is disabled or not working the load time is abysmal.
    If it is working together with browser caching for the images the load time drops to a good result. Pingdom will clock it at around 1.5s vs. >10s from a nearby server.

    If have traced the problem back to Membership 2 Pro by disabling every plugin one by one. You can reproduce the result by toggling Membership 2 on/off.
    Not sure if you checked if Super Cache was activated. Also in the settings. If you were only testing while you were logged in you might not have been served a cached page. If you want to access the site without being logged in: there's a coming soon plugin that needs to be disabled first.

    Hope that clarifies things

    Cheers,
    Peter

  • Peter

    Oookay...

    I had to rearrange the multi site setup for this project because of Buddypress. I can't remember if I had activated M2 for each site seperately or network activated it. I do know for sure the problem occured the first time when I was adding the MS_PROTECT_NETWORK to htaccess.

    After the restructuring multisite I had network activated M2 and then the issue was back. Activating M2 separately for main and subsite works and Super Cache is caching apparently. I might be able to get away with M2 only running on the main site now and not on the subsite. Haven't thought it through all the way yet but there is a chance that could work.
    Still would be nice to be able to run M2 multisite wide without any glitches.

    Currently I am still able to reproduce the problem with the caching.

    Cheers again,
    Peter

  • Peter

    Yeah, what can I say....

    Membership 2 Pro is still killing the caching process.
    Loading the main page for mydomain.com takes ages with M2 active and is nice and fast with M2 disabled. Not sure if there are any other plugins involved that cause M2 to be a problem for Super Cache. But this is definitely a frustrating issue and I can't seem to find a way to work around it.

  • Peter

    It's just about official: I hate Wordpress. This is the worst software concept I have ever worked with or I am on candid camera and somebody is waiting for me to start and throwing and breaking things.

    Tried swapping to W3 Cache. Site seemed to work alright in frontend. Speed seems pretty good. Apparently also with M2 active. Just so find that (parts of) my backend is lagging like crazy or not responding at all. >1min to purge W3 Cache???!
    Creating the cached version of /content/buchtipps/ after purging the cache takes ages. Probably 1-2 mins. Once it's cached the load time seems to be good though.

  • Peter

    Hi Ivan,

    I recreated the entire setup in a brand new install on separate domain. I was able to reproduce the conflict between Membership 2 Pro and Super Cache. W3 doesn't seem to slow down the backend quite so badly here. But there is still some content missing.

    Also disabled every single other plugin this time to see if it takes more than Membership 2 and WP Super Cache to create the issue. And it really boils down to that it is Membership 2 Pro that stops Super Cache from working. No cross fire from any other plugin.

    And of course. It's my theme. Bugger. Works fine with Twenty Seventeen.
    So: Kleo Theme + Membership 2 Pro + Super Cache = trouble

    Did some more testing on the orginal site. There do seem to be some other plugins that can create an issue. Haven't pin pointed it yet. But I had another theme installed there. Which causes the problem just as Kleo does. Both are bootstrap themes.

  • Ivan

    Hi Peter !

    If you provide me with additional login credentials for your new install on the separate domain and you confirm that I can make some changes there, I can look into it more.

    https://premium.wpmudev.org/contact/#i-have-a-different-question
    Please visit our private Contact page and complete the form with the following information:

    Subject: "Attn: Ivan Svyrskyi"

    In the Message box, please provide the following:

    - link back to this thread for reference
    - Step by step instruction for replicate current issue with and without M2 Pro
    - any other relevant urls

    - Admin login:
    Admin username
    Admin password
    Login url

    - FTP/SFTP credentials
    host
    username
    password
    (and port if required)

    Note: Don't send any credentials via this forum because it's public forum.

    Best regards,
    Ivan.

  • Peter

    Hi Ivan,

    followed your instructions and provided all the info you needed.

    Just a quick update. I did some further testing. And to make things a little more convoluted: apparently it matters in what order you activate the plugins and the themes. Also how long one particular setup has been active. Combination of TwentySeventeen + Membership 2 + Super Cache was working when I was testing it yesterday. When I revisited today and ran the test it didn't work anymore. So that's when I noticed it was important from what combination you start and in which order you make the changes matter. Seems like swapping theme first and then activating Membership 2 then Super Cache works with TwentySeventeen (at least initially). But not at all with Kleo(Child) no matter what the order is. Super Cache was always activated this time around.

    Thanks again
    Peter

  • Ivan

    Hi Peter !

    So you think that this issue relates to the combination of Kleo(Child) + Membership 2 + Super Cache. I noticed that Kleo(Child) theme was deactivated on your test site. I activated it, cleared cache and made test then I deactivated M2 plugin, cleared cache and made test again - and I got similar results
    Then I created Buchtipps page on your test site with the same content like on the main site and made these tests again - and my results the similar again.

    Also, I tried to activate MS_PROTECT_NETWORK define but nothing changed.
    Please, told me what do I miss?

    Best regards,
    Ivan.

  • Peter

    Hi Ivan,

    I almost thought I was going slightly mad. When I ran my tests today at first it seemed like I couldn't stop Super Cache from working anymore. So what I can confirm is that Membership 2 + Kleo + Super Cache was working fine together when I started.
    But after I started swapping themes the problem came back. Activated TwentySeventeen and for some reason Super Cache stopped working. Even though tests from previous days seemd to indicate that Twenty Seventeen was fine. So that sort of rules out the bootstrap theme theory.
    When I then reactivated Kleo the caching problem persisted.

    With the minimal site setup without any complex pages the best indicator is WP Super Cache's internal selftest. Pingdom won't be much help here unless you are willing to make calls based on only a few hundred msec differences in load time. So far I am quite happy with the speed of the server. So in order to see anything there you need a page with tons of data and better yet loads of db-queries.

    Hope that helps.

    Peter

  • Ivan

    Hi Peter !

    It seems I found the conflict. As a quick workaround, I did some changes on your test site via FTP.
    I changed the following lines in {wordpress_folder}/wp-content/plugins/membership-2/app/controller/class-ms-controller-gateway.php ( approximataly on 1057th line )
    from

    lib3()->array->equip_post( 'gateway' );
    $gateway_id = $_POST['gateway'];

    to
    $gateway_id = isset( $_POST['gateway'] ) ? $_POST['gateway'] : 0 ;
    It seems it helped. Please, check it.
    Also, I'll ping our developers for fix this issue.

    Best regards,
    Ivan.

  • Peter

    Okaayyyy....
    I messed around a bit on the test install and I haven't been able to reproduce the state that Super Cache wouldn't pass the self test. So that's good
    Tried making the change to the code that you posted on the main install and it didn't seem to take effect right away for whatever reason. Cleared Super Cache. But maybe there was still something left in my browser cache. But the only active action I took was disabling the coming soon plugin. After that the fix seemd to do the trick. Also Super Cache still seemed to work after I enabled the coming soon plugin again.
    But since sometimes for some reason things seemed to work in the past and then suddenly just stopped working for no apparent reason hours later this is not 100% conclusive for my taste yet. But it sure looks very promising

  • Peter

    Hi Ivan

    From what I can tell, your code fixed the problem.
    DONOTCACHEPAGE would explain the effect that I had seen. And exactly - if the coming soon plugin should unintentionally cause Super Cache not to work - who cares? Caching's really only important when the site is active anyway. But it would make sense for coming soon to disable caching to make sure that visitors will definitely get to see the coming soon page instead of a cached regular page.

    Just checked the main site again. Coming soon stops Caching from working. Check.
    Disable coming soon with Membership 2 acitive: Caching with Super Cache works. Check.

    Looks like mission accomplished to me

    So thanks a million again for that.

    I assume eventually there will be an update for Membership 2 with a permanent fix? Just in case there's a new version of M2 before this problem gets fixed - is there anything I can do to make sure I have a working plugin than downloading the current version to make sure I have a version where your code works?

    Cheers,
    Peter