How to resolve an error in advanced-cache.php

If you activate 2 caching plugins (or at least the functionality) at the same time, this might cause a fatal error and break your site.

Follow these instructions to recover your site:

  • Connect to your server via FTP (or an other way if you prefer).
  • Browse to the root of the WordPress installation, where you should have a file named wp-config.php.
  • Download this file and open it in a text editor, such as notepad (Windows) or textedit (Mac).
  • Locate the line define('WP_CACHE', true);, delete it, save the file and upload it back via FTP.
  • Then still via FTP, enter the folder wp-content and delete the file advanced-cache.php
  • You should now be able to reconnect to your administration.
  • Go to one or all of your caching plugins settings, and only keep 1 activated.

If the error comes back before you had a chance to do this:

  • Try the first part again, and before going to the admin, do the following:
  • Using FTP, browse to the folder wp-content/plugins, and rename the folders of all caching plugins (for example by adding a -).
  • Then go to Plugins in your administration, and make sure the cache plugins are deactivated.
  • Using FTP, browse to the folder wp-content/plugins, and rename the folders of all caching plugins back to their original names.
  • You can now reactivate the caching plugin of your choice.

When does WP-Optimize clear the page cache?

Full cache purge:

  • When changing/updating current themes and parent themes (of child themes)
  • When changing/updating current plugins
  • When turning off the cache feature in WP-Optimize
  • When editing widgets
  • When saving the customizer settings
  • When updating a menu
  • When Autoptimize purges its cache
  • When updating permalink structure
  • When changing cache settings
  • When updating string translations in WPML plugin
  • When updating the ‘posts_per_page’ option
  • When purging Avada theme’s fusion caches
  • When saving any of GetWooPlugins’ settings (Premium)

This can be changed by hooking into the filter wpo_purge_cache_hooks. E.g.

// Add a new action that will trigger a cache purge
add_filter( 'wpo_purge_cache_hooks', function( $actions ) {
    $actions[] = 'my_custom_action';
    return $actions;
} );

Partial cache purge:

  • When you publish new content or update/edit existing content, the cache for that post/page will be cleared, as well as associated content (category archives, blog archives)
  • When comments are approved, or their status changes
  • When terms are created or updated
  • When changing/updating stock quantity of WooCommerce product or product variation
  • When updating the ‘page_on_front’ option
  • When updating ‘page_for_posts’ option
  • When updating the ‘URLs to exclude from caching’ WP-Optimize caching configuration
  • When trashing a post
  • When running importers
  • When WooCommerce product is on sale (Premium)


Which web servers is WP-Optimize compatible with?

WP-Optimize is compatible with all web servers, including:

  • Apache
  • Microsoft IIS
  • Litespeed
  • Lighttpd

However, only Apache makes it possible for a WordPress plugin to turn on Gzip compression and static caching headers; thus, on other webservers, WP-Optimize can only test and advise whether these beneficial features are active, but cannot itself turn them on.

I see garbage characters instead of a normal web site, how do I fix this ?

  • If a theme or its files use the call php_flush() or function flush() that will interfere with cache, making the plugin send cached files before essential operations have finished. The flush() call is no longer necessary and should be removed.
  • Some hosting providers, such as GoDaddy or, provide their own caching solutions. This will often interfere with WP-Optimize’s cache, and could result in those garbage characters.
  • Using other speed plugins that force GZIP output can result in this issue. One example is the GZIP compression feature in the plugin “Far Future Expiry Header”, or the setting “enable compression” in the plugin PageSpeed Ninja, which are not compatible with WP-Optimize.

To find out if this is the issue, you can search the code for ob_gzhandler or gzencode. If any of those two strings is found (outside of WP-Optimize), it could be the source of the issue.