• Resolved midwestE

    (@edouble74)


    In the method add_headers that decides if the user should get pages served from cache, the if statement incorrectly determines a woocommerce customer thats logged in should not received cached pages.

    /wp-content/plugins/sg-cachepress/core/DNS/Cloudflare.php: Line ^72

    if (
    			is_admin() ||
    			\is_user_logged_in() ||
    			( function_exists( 'is_cart' ) && \is_cart() ) ||
    			( function_exists( 'is_checkout' ) && \is_checkout() ) ||
    			( function_exists( 'edd_is_checkout' ) && \edd_is_checkout() )
    		) {
    			header( 'Cache-Control: no-store, no-cache, must-revalidate, max-age=0' );
    			header( 'Pragma: no-cache' );
    			header( 'Expires: ' . gmdate( 'D, d M Y H:i:s \G\M\T', time() ) );
    			header( 'SG-Optimizer-Cache-Control: no-store, no-cache, must-revalidate, max-age=0' );
    			return;
    		}

    Woocommerce customers that are logged in SHOULD receive cached pages minus the is_cart and is_checkout checks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Delyan Delov

    (@delyandelov)

    Hi @edouble74,

    I will pass your suggestion to our developers for further consideration to remove the is_user_logged_in() check from the if statement.

    Thread Starter midwestE

    (@edouble74)

    I don’t think it will be quite that easy. Ideally they would add a filter that will allow developers to determine when to engage the cache and when not to.

    Otherwise, I think the current user role would need to be checked to see if they belong to the customer role.

    Plugin Support Delyan Delov

    (@delyandelov)

    If they decide to make such a modification, it will be included in the changelog of the plugin, so keep the SGO up-to-date.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘add_headers with woocommerce customers turns off cache’ is closed to new replies.