WordPress.org

Support

Support » Plugins and Hacks » [Plugin: WP Super Cache] Cache only for admin users

[Plugin: WP Super Cache] Cache only for admin users

  • Hello,

    I want to add an option, or a hack to Wp Super cache in order to cache pages for every user, except admin users.

    I just found an admin option, but it includes every user with comments…

    How can i do such thing ?

    Thanks for your help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Donncha O Caoimh

    @donncha

    You’ll have to modify the check in wp-cache-phase2.php so it only checks is_logged_in() instead of the cookies. Unfortunately you’ll have to do that modification every time you upgrade.

    Thanks for your help.

    The solution is to add this code into the functions.php of the theme : :

    global $super_cache_enabled;
    if ( is_user_logged_in() ) {
    	$super_cache_enabled = false;
    	$cache_enabled = false;
    	if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( 'Not caching for user logged In.', 5 );}

    I am mistaken : it doesn’t work in the functions.php file.

    This code must be included in wp-cache-phase2, on line 360

    if ( is_user_logged_in() ) {
    	$super_cache_enabled = false;
    	$cache_enabled = false;
    	if ( isset( $GLOBALS[ 'wp_super_cache_debug' ] ) && $GLOBALS[ 'wp_super_cache_debug' ] ) wp_cache_debug( 'Not caching for user logged In.', 5 );}
    Plugin Author Donncha O Caoimh

    @donncha

    Actually, there’s a hook in the cookie function. You could hook into that and check is_user_logged_in().

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP Super Cache] Cache only for admin users’ is closed to new replies.