Title: [Plugin: WP Super Cache] Clear cache when user login??
Last modified: August 19, 2016

---

# [Plugin: WP Super Cache] Clear cache when user login??

 *  Resolved [javiarques](https://wordpress.org/support/users/javiarques/)
 * (@javiarques)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/)
 * Hi,
    I’m having this problem. All my cache is cleared when a user log into the
   web. Is there any wp hook that I have to unable? This is my config: mod_rewrite
   + compress + don’t cache known users + mobiles + 3600 expritaion date

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

 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/#post-1697345)
 * It shouldn’t do that. Have you tried using the debug system in the plugin to 
   track down what the problem may be?
 *  Thread Starter [javiarques](https://wordpress.org/support/users/javiarques/)
 * (@javiarques)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/#post-1697637)
 * Resolved,
    It is Buddypress that clear all cache when an user login, the solution,
   remove the filter, put it into your functions.php:
 * `remove_action('wp_login', 'bp_core_clear_cache');`
 *  Plugin Author [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/#post-1697638)
 * Bizarre. It looks like a drastic action to take but the original code is [here](http://svn.buddypress.org/tags/1.0.1/bp-core.php).
 *  [mmln](https://wordpress.org/support/users/mmln/)
 * (@mmln)
 * [15 years ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/#post-1697671)
 * hi javiarques/Donna,
 * Could you tell me in more detail ?
    functions.php is it located under ‘wp-includes’?
   or under theme files ? in functions.php where exactly I need to add this remove_action?
 *  Thread Starter [javiarques](https://wordpress.org/support/users/javiarques/)
 * (@javiarques)
 * [15 years ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/#post-1697672)
 * Hi mmln,
    You just have to insert the line `remove_action('wp_login', 'bp_core_clear_cache');`
   in your functions.php located in your theme. And if you dont’t have it, just 
   create it, and it will be called by WP.
 *  Thread Starter [javiarques](https://wordpress.org/support/users/javiarques/)
 * (@javiarques)
 * [15 years ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/#post-1697673)
 * This is the function created in Buddypress plugin
 *     ```
       /**
        * bp_core_clear_cache()
        * REQUIRES WP-SUPER-CACHE
        *
        * When wp-super-cache is installed this function will clear cached pages
        * so that success/error messages are not cached, or time sensitive content.
        *
        * @package BuddyPress Core
        */
       function bp_core_clear_cache() {
   
       	global $cache_path, $cache_filename;
   
       	if ( function_exists( 'prune_super_cache' ) ) {
       		do_action( 'bp_core_clear_cache' );
   
       		return prune_super_cache( $cache_path, true );
       	}
       }
       ```
   
 * This function is called tons of times!!!!, and that’s an extreme solution for
   my huge portal [el embarazo .net](http://elembarazo.net/), with more than 3000
   cached posts, and 20.000 users:
 *     ```
       // List actions to clear super cached pages on, if super cache is installed
       add_action( 'bp_blogs_remove_data_for_blog', 'bp_core_clear_cache' );
       add_action( 'bp_blogs_remove_comment', 'bp_core_clear_cache' );
       add_action( 'bp_blogs_remove_post', 'bp_core_clear_cache' );
       add_action( 'bp_blogs_remove_blog_for_user', 'bp_core_clear_cache' );
       add_action( 'bp_blogs_remove_blog', 'bp_core_clear_cache' );
       add_action( 'bp_blogs_new_blog_comment', 'bp_core_clear_cache' );
       add_action( 'bp_blogs_new_blog_post', 'bp_core_clear_cache' );
       add_action( 'bp_blogs_new_blog', 'bp_core_clear_cache' );
       add_action( 'bp_blogs_remove_data', 'bp_core_clear_cache' );
   
       add_action( 'wp_login', 'bp_core_clear_cache' );
       add_action( 'bp_core_render_notice', 'bp_core_clear_cache' );
   
       add_action( 'bp_forums_new_forum', 'bp_core_clear_cache' );
       add_action( 'bp_forums_new_topic', 'bp_core_clear_cache' );
       add_action( 'bp_forums_new_post', 'bp_core_clear_cache' );
   
       add_action( 'friends_friendship_rejected', 'bp_core_clear_cache' );
       add_action( 'friends_friendship_accepted', 'bp_core_clear_cache' );
       add_action( 'friends_friendship_deleted', 'bp_core_clear_cache' );
       add_action( 'friends_friendship_requested', 'bp_core_clear_cache' );
   
       add_action( 'groups_join_group', 'bp_core_clear_cache' );
       add_action( 'groups_leave_group', 'bp_core_clear_cache' );
       add_action( 'groups_accept_invite', 'bp_core_clear_cache' );
       add_action( 'groups_reject_invite', 'bp_core_clear_cache' );
       add_action( 'groups_invite_user', 'bp_core_clear_cache' );
       add_action( 'groups_uninvite_user', 'bp_core_clear_cache' );
       add_action( 'groups_details_updated', 'bp_core_clear_cache' );
       add_action( 'groups_settings_updated', 'bp_core_clear_cache' );
       add_action( 'groups_unban_member', 'bp_core_clear_cache' );
       add_action( 'groups_ban_member', 'bp_core_clear_cache' );
       add_action( 'groups_demote_member', 'bp_core_clear_cache' );
       add_action( 'groups_premote_member', 'bp_core_clear_cache' );
       add_action( 'groups_membership_rejected', 'bp_core_clear_cache' );
       add_action( 'groups_membership_accepted', 'bp_core_clear_cache' );
       add_action( 'groups_membership_requested', 'bp_core_clear_cache' );
       add_action( 'groups_create_group_step_complete', 'bp_core_clear_cache' );
       add_action( 'groups_created_group', 'bp_core_clear_cache' );
       add_action( 'groups_group_avatar_updated', 'bp_core_clear_cache' );
   
       add_action( 'messages_delete_thread', 'bp_core_clear_cache' );
       add_action( 'messages_send_notice', 'bp_core_clear_cache' );
       add_action( 'messages_message_sent', 'bp_core_clear_cache' );
   
       // Don't cache message inbox/sentbox/compose as it's too problematic
       add_action( 'messages_screen_compose', 'bp_core_clear_cache' );
       add_action( 'messages_screen_sentbox', 'bp_core_clear_cache' );
       add_action( 'messages_screen_inbox', 'bp_core_clear_cache' );
       ```
   
 * Y prefer, rather than clearing cache, do not store community pages into my cache.
 * And I have modified `bp_core_clear_cache` and now do nothing.
 *     ```
       /**
        * bp_core_clear_cache()
        * REQUIRES WP-SUPER-CACHE
        *
        * When wp-super-cache is installed this function will clear cached pages
        * so that success/error messages are not cached, or time sensitive content.
        *
        * @package BuddyPress Core
        */
       function bp_core_clear_cache() {
   
               return true;
   
       	global $cache_path, $cache_filename;
   
       	if ( function_exists( 'prune_super_cache' ) ) {
       		do_action( 'bp_core_clear_cache' );
   
       		return prune_super_cache( $cache_path, true );
       	}
       }
       ```
   
 *  [mmln](https://wordpress.org/support/users/mmln/)
 * (@mmln)
 * [15 years ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/#post-1697674)
 * Hi javiarques,
 * I tried removing action from wp_login, it does the job but from only one ‘login’
   form. As you mentioned this cache prune is called many times.
 * Could you tell me the modification you did to the bp_core_clear_cache so that
   it does nothing ?
 * Any way I am not going to cache the community pages, but just the blog posts.
 *  Thread Starter [javiarques](https://wordpress.org/support/users/javiarques/)
 * (@javiarques)
 * [15 years ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/#post-1697676)
 * You just have to modify the `bp_core_clear_cache` function so that the function
   does nothing, just return true.
    It’s not the best solution because you have 
   to modify a plugin file wich can be updated in the future, but I dont know a 
   better way because there are no actions or filters to hook.
 * bp-core.php line 1883
 *     ```
       function bp_core_clear_cache() {
   
       return true;
       }
       ```
   

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

The topic ‘[Plugin: WP Super Cache] Clear cache when user login??’ 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/)

 * 8 replies
 * 3 participants
 * Last reply from: [javiarques](https://wordpress.org/support/users/javiarques/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/plugin-wp-super-cache-clear-cache-when-user-login/#post-1697676)
 * Status: resolved