WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
mfunc gets cached (3 posts)

  1. sylverCode
    Member
    Posted 1 year 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.

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. Steve Borsch
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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';
    <!--mfunc-->

    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

About this Topic