Pages not cached, or Minify CSS/JS not working

WP Rocket by default delivers cached pages for visitors who are not logged-in WordPress users. When you’re checking if caching works as expected, make sure one of the following conditions is true:

  • Either: You’re logged out of WordPress
  • Or: You’ve enabled User Cache on the Cache tab

If you believe that WP Rocket is not caching your pages or is not minifying your CSS and JS files, it might be that the minimum requirements for the plugin to function have not been met. Or it could be that you have previously installed other caching plugins, and even if you deleted them via the WordPress dashboard, they have left files and configuration behind.

In this article

Writing permissions

In order to function correctly, WP Rocket needs be able to create and write to certain files and folders within your WordPress install. The following files and folders are associated with, or written to by WP Rocket:

{wordpress root folder}
┣━.htaccess
┣━wp-config.php
┗━wp-content
  ┣━advanced-cache.php
  ┣━cache
  ┃ ┣━busting
  ┃ ┣━critical-css
  ┃ ┣━min
  ┃ ┗━wp-rocket
  ┗━wp-rocket-config

.htaccess

{wordpress root folder}
┗━.htaccess

On Apache servers, the .htaccess file needs to be writable for WP Rocket (CHMOD 0644). After activation there should be a large block of code present from WP Rocket, beginning at the very top of the file:

# BEGIN WP Rocket v{version number}

… lots of code in here …

# END WP Rocket

… other code down here

wp-config.php

{wordpress root folder}
┗━wp-config.php

The wp-config.php file needs to be writable for WP Rocket (CHMOD 0644). Make sure that the following line is present at the top of wp-config.php, after the opening <?php tag. If it is too far down in the file, WP Rocket will not work!

define( 'WP_CACHE', true ); // Added by WP Rocket

Also, make sure there is no reference to another caching plugin. For example, WP Super Cache leaves this line behind:

define( 'WPCACHEHOME', '{/path/to/wordpress/root/}wp-content/plugins/wp-super-cache/' ); //Added by WP-Cache Manager

advanced-cache.php

{wordpress root folder}
┗━wp-content
  ┗━advanced-cache.php

Make sure that advanced-cache.php in the wp-content folder references only WP Rocket.

WP Rocket configuration folder

{wordpress root folder}
┗━wp-content
  ┗━wp-rocket-config

Make sure a folder named wp-rocket-config is present in wp-content. If it isn’t, create it, and make sure WP Rocket can write to it.

Cache folder (and subfolders)

{wordpress root folder}
┗━wp-content
  ┗━cache
    ┣━busting
    ┣━critical-css
    ┣━min
    ┗━wp-rocket

Make sure that WP Rocket has writing permissions for the cache folder (CHMOD 0755), and that it contains the 4 subfolders depicted above. All of these WP Rocket needs to be able to write to. If these folders don’t exist you should create them manually.

Cleaning up the cache folder

If you had any other caching plugin previously enabled, it may have left behind its own folders. We recommend to delete those.

WP Super Cache creates a wp-cache-config.php file in wp-content which should be deleted.

W3 Total Cache creates the following files and folders in wp-content which should be deleted:

wp-content         (keep!)
┣━cache            (keep!)
┃ ┣━config         (delete)
┃ ┣━db             (delete)
┃ ┣━minify         (delete)
┃ ┣━object         (delete)
┃ ┗━page_enhanced  (delete)
┣━db.php           (delete)
┣━object-cache.php (delete)
┗━w3tc-config      (delete)

(It may create other folders based on individual settings.)

Note: While it’s fine to delete any files and folders of caching plugins you don’t use anymore, even some themes may create a subfolder in the cache folder. You should always keep those.

Multisite and domain mapping

If you have a multisite installation using domain mapping, try logging into your admin area using the mapped domain instead of the original domain, and then de-activate and re-activate WP Rocket. This will enable WP Rocket to detect the correct domain and activate caching.

Other plugins disabling caching

Sometimes another plugin may set the constant DONOTCACHEPAGE. What this does is override all caching plugins by blocking caching from working. So this would need to be removed and the developer of that plugin informed.

Two common plugins that add a DONOTCACHEPAGE constant are:

  • s2 Member
  • WooCommerce Klarna Gateway.

You can see if the constant is what’s causing cache problems by installing this helper plugin which will allow WP Rocket to apply caching even if the DONOTCACHEPAGE constant has been defined somewhere else:

📥  Download (.zip): WP Rocket | Force Page Caching
Developers: You can find the code for this plugin on GitHub.

SSL Cache

If you use SSL on your website, make sure that SSL Cache is active in your settings. Depending on your individual install you may have to activate the option manually, or it will be active automatically. See this article:
Using SSL with WP Rocket

Theme compatibility

Make sure your current theme references wp_footer(). If it is missing, adding it to the footer.php template, right before the closing </body> tag, usually resolves the issue:

After making any of these adjustments, de-activate and re-activate WP Rocket once. Then verify if WP Rocket is working by following this article:
How to check if WP Rocket is caching your pages

Other server requirements

  • mod_expire and mod_deflate should be enabled (ask your webhost to enable these)
  • No restriction on the tmp folder
  • curl_exec function should be enabled