Caching support

Difficulty: Advanced | Updated: March 12, 2018

Keep in mind that just installing a caching plugin does not necessarily make your site faster. Doing a bit of optimization will get you a lot of speed increase without caching plugins. To further combat slowness you may want to re-evaluate the performance of your hosting package. Maybe you’ve outgrown it. In that case, upgrade to a better hosting solution. Likewise using cheap hosting will affect performance. You can read a bit more about there: Caching to improve your lousy hosting.

Enable caching support

AdRotate has basic support for the popular W3 Total Cache and Borlabs Cache plugins. Which you can enable in AdRotate settings.
The developers of WP-Rocket have informed me that AdRotate works with their plugin, too. No configuration required according to them. I have not tested this myself.

Enabling caching support is as easy as enabling a checkbox in AdRotate Settings. After you’ve enabled your caching plugin you need to clear your websites cache so your choice can be cached. You also need to make a few settings in the caching plugin. This will allow adverts to rotate as intended.

Mixing caching and dynamic content is a tricky thing to do and often causes all kinds of issues. AdRotate follows the guidelines from the caching plugins. If it doesn’t work it’s very likely you didn’t configure the plugin correctly. Alternatively you can decide to just not enable caching support in AdRotate – Your adverts will show up just fine but rotation and stats using the internal tracker may be affected.

Set up with W3 Total Cache

  • In AdRotate Settings under Misc enable the checkbox for W3 Total Caching.
  • If prompted by AdRotate; Add the W3TC_DYNAMIC_SECURITY definition to your wp-config.php file (See below for details).

Configuring W3 Total Cache

How to fully set up W3 Total Cache is beyond the scope of this page. Check the W3 Total Cache manuals or contact it’s developer for help with that if you need it.

  • In General Settings set the Page Caching to Disk: Basic.
  • In Page Cache under Advanced enable Late Initialization.
  • If you use the Minify option add ‘mfunc’ to the ignored comment stem field.


You may need to flush the cache after making these changes.

Setting up the Dynamic Security hash for W3 Total Cache

This is a manual edit to your wp-config.php file. Making typos or mistakes in this file may cause your site to fail!

Here’s how to add the W3TC_DYNAMIC_SECURITY definition to your site. The string is randomised and should be treated as a password. Adding this line to your WordPress setup allows W3 Total Cache to use fragmented caching in a secure manner.

  • Login to your site via (s)FTP and look in the root/base directory of your site.
  • Download the wp-config.php file to your desktop.
  • Edit the file with your favourite Editor – I use Coda 2.
  • Somewhere below Line 52 add the line as directed by AdRotate.
  • Save and upload the wp-config.php file overwriting the current online version.

For my version of wp-config.php the first best spot was on line 57. Right below the WordPress security salts.
adrotate-w3tc-wp-config

Setting up with Borlabs Cache

  • In AdRotate Settings under Misc enable the checkbox for Borlabs Cache.

Configuring Borlabs Cache

How to fully set up Borlabs Cache is beyond the scope of this page. Check the Borlabs Cache manuals or contact the developer for help with that.

  • In Fragments enable Fragment Caching.
  • Set a random Fragment Mask Phrase in the Fragments page.


AdRotate will detect these settings and use them as needed for the output for Widgets, Post Injection and Shortcodes.
You may need to flush the cache after making these changes.