Title: save draft clears all cache
Last modified: March 18, 2024

---

# save draft clears all cache

 *  Resolved [marcoskito](https://wordpress.org/support/users/marcoskito/)
 * (@marcoskito)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/)
 * Hello, when saving a page in draft, the cache is cleared.
   For example, I press
   to write a new post, any time I press save draft, the entire plugin cache is 
   deleted, this happens every time the save draft button is pressed.I wanted to
   know if this is a problem with the plugin or is it something that was actually
   supposed to happen?

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [yallaman](https://wordpress.org/support/users/yallaman/)
 * (@yallaman)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17511585)
 * Did the problem start with the update last week (version 1.12.0)?
 * I have used this plugin for many years, and I have never experienced that _all_
   cache is deleted when saving a draft. I was thinking of updating to 1.12.0 today,
   but I will wait until we hear from the plugin author.
 * Edit:
   Do you, by any chance, have _“Clear all cache files when a post or page
   is published or updated”_ enabled in the Advanced tab in the plugin settings?
   I have it disabled/off.
    -  This reply was modified 2 years, 2 months ago by [yallaman](https://wordpress.org/support/users/yallaman/).
 *  Thread Starter [marcoskito](https://wordpress.org/support/users/marcoskito/)
 * (@marcoskito)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17512860)
 * I started using the plugin in the most current version, 1.12.0.
   I did the test
   here with and without the option “Clear all cache files when a post or page is
   published or updated” , but the result is the same.
 *  [yallaman](https://wordpress.org/support/users/yallaman/)
 * (@yallaman)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17512959)
 * Strange. Two weeks ago another user had the same problem: 
   [https://wordpress.org/support/topic/full-cache-delete-on-post-edit/](https://wordpress.org/support/topic/full-cache-delete-on-post-edit/)
 * The issue was not resolved (because he moved on to another caching plugin). Hopefully
   the plugin author can chime in.
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17514287)
 * [@marcoskito](https://wordpress.org/support/users/marcoskito/) I created a few
   test posts on a site and then created another post I did not publish, but I saved
   it as a draft post. The posts I had already published were still cached. I saw
   this in the debug log:
 * > wp_cache_post_edit: draft post, not deleting any cache files. status: draft
   > 
   > wp_cache_post_change: draft post, not deleting any cache files.
 * Was the post you were editing a new post, or one that had been published before,
   but you changed to a draft? If it was a post that had been published before, 
   then the cache files for only that post should have been deleted.
 * Please enable debugging in the plugin. If you change a published post to a draft
   post, you should see the line “wpsc_post_transition: deleting cache of post:”
   in the debug log with the URL of your post. The following lines of the log will
   show you what was deleted:
 * > wpsc_delete_files: deleting [URL]
 * [@yallaman](https://wordpress.org/support/users/yallaman/) – If there is a problem
   with this, then it’s a very rare bug. Hopefully, [@marcoskito](https://wordpress.org/support/users/marcoskito/)
   can reply with some information after looking at their debug log.
 *  Thread Starter [marcoskito](https://wordpress.org/support/users/marcoskito/)
 * (@marcoskito)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17514967)
 * Hi [@donncha](https://wordpress.org/support/users/donncha/),
   The cache is cleared
   when an unpublished post has a draft saved.I deactivated practically all the 
   plugins, leaving only the basic ones (Elementor, Rank Math SEO, WP Super Cache
   and those of the theme itself, SmartMag Core and Sphere Core).In debugging, in
   the log, wpsc_delete_files does not appear anywhere.When the post draft is saved,
   the log shows the following:
 *     ```wp-block-code
       12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user wp_cache_replace_line: setting not changed - $wp_cache_debug_log = '63082ab0055fe7dc1dd6946f861c4c58.php';12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user wp_cache_replace_line: setting not changed - $wp_cache_debug_username = 'f17013a12153ec402d79b90ef065f37c';12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/index.html as it's protected.12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user prune_super_cache: did not delete file: /var/www/html/sitename/wp-content/cache/index.html12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/index.html as it's protected.12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/.htaccess as it's protected.12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user prune_super_cache: did not delete file: /var/www/html/sitename/wp-content/cache/.htaccess12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/.htaccess as it's protected.12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/meta/index.html as it's protected.12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user prune_super_cache: did not delete file: /var/www/html/sitename/wp-content/cache/meta/index.html12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/meta/index.html as it's protected.12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/meta as it's protected.12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/supercache/index.html as it's protected.12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user prune_super_cache: did not delete file: /var/www/html/sitename/wp-content/cache/supercache/index.html12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/supercache/index.html as it's protected.12:47:48 24299 /wp-admin/post.php?post=187210&action=edit&meta-box-loader=1&meta-box-loader-nonce=fd87c7b3c4&_locale=user gc: could not delete /var/www/html/sitename/wp-content/cache/supercache as it's protected.12:47:48 24268 /wp-admin/post.php?post=187210&action=edit&message=4 wp_cache_postload: DONOTCACHEPAGE defined. Not running.
       ```
   
 * 
   After that, it starts loading pages to cache normally.
    -  This reply was modified 2 years, 2 months ago by [marcoskito](https://wordpress.org/support/users/marcoskito/).
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17517340)
 * [@marcoskito](https://wordpress.org/support/users/marcoskito/) that’s really 
   weird. It seems to me that WP Super Cache isn’t deleting the cache, but some 
   other code on your server is.
 * If you can replicate your server on a test server, and then disable those plugins
   and change your theme you might be able to figure out which one is causing the
   problem.
 *  Thread Starter [marcoskito](https://wordpress.org/support/users/marcoskito/)
 * (@marcoskito)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17540176)
 * [@donncha](https://wordpress.org/support/users/donncha/), just returning to let
   you know that it’s something related to the theme, when putting the default WordPress
   theme, the cache is not cleared when a draft is saved.
   I’m going to contact the
   developer to see if he can resolve it, but I wanted to know if there is any way
   to not allow other plugins or themes to clear the cache.
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17558978)
 * There isn’t a way to stop other plugins or themes from deleting the cache. Extra
   security key measures might be put in place but the files are created by the 
   web server so any PHP code on the server could go through the files deleting 
   them, no matter what the plugin does.
 *  Thread Starter [marcoskito](https://wordpress.org/support/users/marcoskito/)
 * (@marcoskito)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17562710)
 * [@donncha](https://wordpress.org/support/users/donncha/), let me be clearer, 
   I wanted to know if there is a way to prevent other plugins from asking WP Super
   Cache to clean their cache? This way, the plugin would be solely responsible 
   for cleaning, without others getting in the way or asking it to do so.
   Would 
   it be possible to create an option to remove the cleaning hooks that other plugins
   use to ask WP Super Cache to do this cleaning, if an option in the plugin itself
   is not possible, is there any way to do this?
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17563794)
 * There isn’t a way to do what you want, and no point in trying to stop other plugins
   clearing the cache, sorry.
 * It could possibly be done by rewriting the plugin using classes and making anything
   that cleared the cache a private function, but then another plugin just needs
   to manually delete the cache folder with their own recursive function.
 *  Thread Starter [marcoskito](https://wordpress.org/support/users/marcoskito/)
 * (@marcoskito)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17563890)
 * [@donncha](https://wordpress.org/support/users/donncha/), what I’m trying to 
   say is that I know that other plugins have access to the cache folder and that
   they can do this, but they ask WP Super Cache to do it for them.
   I just wanted
   to prevent other plugins from asking WP Super Cache to clear the cache.For example,
   you have a plugin installed that does the following:
 *     ```wp-block-code
       if (function_exists('wp_cache_clear_cache')) {
       			wp_cache_clear_cache(
       				is_multisite() ? get_current_blog_id() : 0
       			);
       		}
       ```
   
 * I just wish WP Super Cache didn’t recognize this command and didn’t clean it 
   because of other plugins.
   I wanted WP Super Cache to be “isolated” from receiving
   commands from other plugins, and only delete the cache according to the settings.
   Would it be possible to do something like this as a function for the plugin or
   would deleting some lines for these functions be enough?
    -  This reply was modified 2 years, 2 months ago by [marcoskito](https://wordpress.org/support/users/marcoskito/).
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17595618)
 * Unfortunately, you should probably report this as a bug to the other plugin or
   theme, as it’s too aggressive. There’s nothing this plugin can do, as that’s 
   what it’s supposed to do.
 *  [dowista](https://wordpress.org/support/users/dowista/)
 * (@dowista)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17990715)
 * Hello [@marcoskito](https://wordpress.org/support/users/marcoskito/)
 * I was with similar problem, after update product, all cache files deleted. I 
   found Rank Math plugin delete all this. If someone have problem with that and
   have rank math plugin, in your theme functions add this:
 * `add_filter( 'rank_math/sitemap/enable_caching', '__return_false');`

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘save draft clears all cache’ is closed to new replies.

 * ![](https://ps.w.org/wp-super-cache/assets/icon-256x256.png?rev=3506220)
 * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-super-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-super-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-super-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-super-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-super-cache/reviews/)

 * 13 replies
 * 4 participants
 * Last reply from: [dowista](https://wordpress.org/support/users/dowista/)
 * Last activity: [1 year, 9 months ago](https://wordpress.org/support/topic/save-draft-clears-all-cache/#post-17990715)
 * Status: resolved