W3 Total Cache
mfunc gets cached (3 posts)

  1. sylverCode
    Posted 3 years ago #

    Basically, I'm trying to make my widget stay dynamic.

    I've tried all the variations of mfunc syntax, but the code it's meant to protect from caching still gets cached.

    This is a sample of my code:

    <!--mfunc echo ( is_user_logged_in() ) ? 'logged in' : 'logged out'; --><?php echo ( is_user_logged_in() ) ? 'logged in' : 'logged out'; ?><!--mfunc-->

    I'm pretty sure W3 Total Cache reads the code properly as the mfunc tag disappears when viewed through the source code.

    Page cache: Disk Basic is the only option that's enabled, everything else is disabled.

    If anyone knows a way to exclude the sidebar from getting cached I'll gladly do that instead.


  2. Steve Borsch
    Posted 3 years ago #

    Having the same issue (as are many others on the Woocommerce forum) since my site uses Woocommerce pro and the shopping cart gets cached between sessions.

    Fragment caching *should* work (so as to not cache the cart dynamic plugin between sessions) but it doesn't work, regardless .

    It would be great if W3 Total Cache had an "This Installation" tab in wp-admin which listed all currently installed plugins, pages and so forth and we could check a box to not cache certain pages and dynamic widgets.

    Anyone have a thought?

  3. mbrinson
    Posted 3 years ago #

    Your syntax is wrong. Try this instead:

    <!--mfunc -->
    echo ( is_user_logged_in() ) ? 'logged in' : 'logged out';
    echo ( is_user_logged_in() ) ? 'logged in' : 'logged out';

    The <!--mfunc--> comment tags actually REPLACE the <?php tags.

    That being said, after upgrading to the most recent version of w3 Total Cache on one of my sights, I am having an issue with mfunc - I get a 500 server error for the whole site. Then it's fine if I revert back to <?php tags instead, but then my php code is no longer dynamic anymore.
    Not sure what the deal is with that..

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • W3 Total Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic