• Resolved praveen_khm

    (@praveen_khm)


    Hi,

    Thank you for the awesome free plugin. This really helped a lot in our gtmatrix score. After installing the plugin and configuring it, the site seems blazing fast except for a fact that when someone logs in using our custom theme login page, it does not refresh and still shows login link. As per the suggestions here, I disabled “expires header” and “set cache with validate” and everything seems ok. But now the speed is gone and will take 3-4 seconds to validate and load.

    Is there anything I can do to just validate the widget rather than the whole page? Just for this simple reason, I am losing on a fast website.

    Once again, thank you for the awesome plugin.

    Thanks,
    Praveen

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @praveen_khm

    Thank you for your inquiry and I am happy to assist you with this.
    You can use Page Fragment Cache for this. Please check our FAQ for more details.

    You have to define the variable in your wp-config.php file. For security reasons, W3 Total Cache compares the string used in cached pages to the defined variable.
    We recommend you choose a memory-based caching backend such as Redis or Memcached as this will not work with Disk: Enhanced, but if not available you should use the Disk Caching method.
    Enable “late initialization” on the Page Cache settings page.
    in your wp-config.php:
    define('W3TC_DYNAMIC_SECURITY', 'mysecurestring');
    You are then able to use the mfunc and mclude comments as a replacement of the PHP-tags like this:

    <!-- mfunc mysecurestring -->
    echo do_shortcode('[your_shortcode]');
    <!-- /mfunc mysecurestring -->

    Wrapping the shortcode with the mfunc comment will ensure that the dynamic part of the page, in this case, the shortcode is not cached.
    I hope this helps!
    Thanks!

    Thread Starter praveen_khm

    (@praveen_khm)

    Thanks for the response. It still does not work. These are the things I have done:

    Added the below code in wp-config.php

    define('W3TC_DYNAMIC_SECURITY', 'mysecurestring');

    In Header.php, I have added this.

    <!--mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
    	mytheme_extra_hotline();
    	mytheme_extra_cart();
    	mytheme_extra_account();
            echo(rand(10,100));
    <!--/mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->

    Since I am using a shared hosting, changed Disk Enhanced to Disk Caching method and enabled “late initialization” on the Page Cache settings page.

    Added “mfunc” and “mclude” to Ignored comment stems under minify.

    Whatever I did, it still did not refresh the code within mfunc. Lastly, I changed Expires header lifetime to 10 seconds and now it updates. However, the complete page is refreshing every 10 seconds.

    Is there some setting I am missing?

    Thanks,
    Praveen

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @praveen_khm

    Thank you for the information.
    The conde is incorrect. you should wrap the widget with the mfunc and that will keep it uncached.
    However, the main reason is the Expires header lifetime, so if everything is working as expected with the Expires header disabled or set to 10s you should leave it that way.
    Please note that this is a browser Cache. The users are still getting the cached version of the page but in order for the login functionality to work it needs to be refreshed in the browser cache for the users.
    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to disable caching for logged in link or widget’ is closed to new replies.