Support » Plugin: WP Super Cache » WP Super Cache shows DONOTCACHEPAGE defined for every page viewed

  • Resolved KirkM


    Note: WP Super Cache stopped working while the blog was using version 3.2. One day it was working, the next day it was not.

    I’ve been using WP SuperCache since it was first released and it’s always worked fine on my 6 year old blog up till a couple of versions ago. Unfortunately, without any significant changes to my hosting server (Bluehost), plugins that I use or theme, Super Cache simply stopped working one day (.9.x series) and has not worked since up to and including 1.0. As I said before, Super Cache has always worked flawlessly for me in the past and it’s not like I performed some massive change to the site. Super Cache was simply working one day and then stopped working the next–no entries in any error log. The one error I can see is when I hit the “Test” button, I get these results:

    Fetching to prime cache: OK

    Fetching first copy of OK (1.html)

    Fetching second copy of OK (2.html)

    The pages do not match! Timestamps differ or were not found!

    (I always use mod_rewrite to serve cache files.)

    The timestamps are definitely not there in fact all WP SuperCache entries have disappeared from the bottom of any page source. When checking the site via Filezilla all SuperCache directories and files are in place, all absolute paths are correct. However, the single exception to all this is that there are no cached (page) files in ‘wp-content/cache’ whatsoever nor is there a ‘wp-content/cache/supercache/’ directory and if I manually create one, it always remains empty.

    Enabling debugging gave me a clue though. It states that for every page viewed it gives me this:

    “(path to page…) DONOTCACHEPAGE defined. Caching disabled.”

    These viewed pages are from visitors to my site and are not viewed by myself while logged in. The kicker here is that DONOTCACHEPAGE is not defined. Caching is enabled, the .htaccess entries are correct as is the “wp-config” (“define(‘WP_CACHE’, true); //Added by WP-Cache Manager”) entry and the line is placed properly as well. Nowhere in any Super Cache setting is caching not defined.

    And the real crusher is that W3TC works fine when I tried it.

    I’ve deactivated all my plugins, changed to the default theme, checked all the troubleshooting points and nothing. And I really don’t wish to change to W3TC as I simply do not need all the myriads of options.

    Any help you could give me will be well appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Try renaming your .htaccess file then re-saving your permalinks and wp-super-cache settings.

    You can also try Quick Cache.

    Now my main error log of my site is filling with the following two error lines regarding to WP Super Cache (this is a good thing actually).

    These are the two lines that keep repeating:

    [06-Dec-2011 16:36:33] PHP Warning: Invalid argument supplied for foreach() in /home3/longmead/public_html/just-thinkin/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 156
    [06-Dec-2011 16:36:33] PHP Warning: Invalid argument supplied for foreach() in /home3/longmead/public_html/just-thinkin/wp-content/plugins/wp-super-cache/wp-cache-phase1.php on line 452

    Line 156 of “/just-thinkin/wp-content/plugins/wp-super-cache/wp-cache-phase2.php” reads:

    foreach ( $cache_rejected_uri as $expr ) {
    		if( $expr != '' && @preg_match( "~$expr~", $uri ) )
    			return true;

    Line 452 of “/home3/longmead/public_html/just-thinkin/wp-content/plugins/wp-super-cache/wp-cache-phase1.php” reads:

    foreach ($cache_rejected_user_agent as $expr) {
    		if (strlen($expr) > 0 && stristr($headers["User-Agent"], $expr))
    			return true;

    Heh, well, that’s all fine and dandy but I have no idea what is “invalid” about it and no idea how to fix it.

    Still looking at the error log in my site’s root directory and every time I view a page in another browser (logged out) it adds the same two lines as shown previously to the log.

    Plugin Author Donncha O Caoimh


    If you can ssh to your server use grep to find out where DONOTCACHEPAGE is defined. It might be hidden away somewhere, maybe if you were testing something months ago?

    You could also try adding checks for that constant in wp-settings.php – use error_log to flag it in a log file if it’s defined. Start at the top and move the check down the file and you might find that some file defines it and when it’s included the error_log will run.

    Plugin Author Donncha O Caoimh


    Kirk – make sure the “Rejected URIs” and “Rejected User Agents” fields on the advanced settings page are set to something.

    Sorry for the delay in replying. Things got busy for the last few days.

    The problem turned out to be a conflict with the last two versions (3.9.7 and 3.9.8) of the Text Link Ads plugin for WordPress. After enabling WP Super Cache debugging and checking the resulting log, it showed that there was a “DONOTCACHE is defined” statement after every page viewed on my site as long as the TLA plugin was activated. Although I couldn’t actually find this exact statement in the options table in my site’s DB I’m pretty sure that’s where it was being added. It’s certainly not in the source code of any page/post on my site. Once the TLA plugin was deactivated and removed, WP Super Cache began working properly once more.

    I’ve run both plugins side by side for nearly two years now without a problem but apparently when TLA jumped from version 3.5.1 directly to 3.9.7 the problem began. Unfortunately, 3.5.1 no longer works with the latest version of WordPress so I can’t do any compatibility tests. TLA support acknowledged the problem but offers no solution at the moment. They said they’d look into it though.

    Since it’s more important to me to keep my site properly cached than having a steady source of packet change for coffee and donuts every month, the TLA plugin got booted. Thanks much for the help Donncha and bh_WP_fan. I’m marking this topic resolved.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WP Super Cache shows DONOTCACHEPAGE defined for every page viewed’ is closed to new replies.