• Resolved startingwordpressdev

    (@startingwordpressdev)


    Hi,

    Is there any way to disable caching of specific shortcodes on a page? I am using AmazonAssociatesLinkBuilder(AALB) plugin which shows geo-targeted ads(ads depending on country of the customer). But due to caching, the first ad being rendered by AALB’s shortcode is shown to all customers from different countries. Is there any way to:

    • Either, not cache AALB’s shortcodes?
    • Or, do something like country-specific caching for a post/page? For example, if after an Italian User has visited the post/page, an Indian user comes, he should be shown an Amazon.in advertisement as there will be an India specific cache for that post/page.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor gidomanders

    (@gidomanders)

    You could change the Page Cache to Disk: basic and use Fragment Caching to disable page cache for that specific part of code. If you need more details, please ask.

    Hi, I’m having an issue with the Fragment Caching too.
    I have the “W3TC Pro edition” but I cannot check the Late Initialization option. Not sure if this option is a “must” to run properly any Fragment Caching.

    My objective is the avoid caching a shortcode that is launched from the theme “header.php” file. So following the instruction from W3Edge developers I have added the code below:

    <!– mfunc mycode –>
    <?php echo do_shortcode(‘[responsive_menu_pro]’); ?>
    <!– /mfunc mycode –>

    Inside the “wp-config.php” file there is the next line:
    define(‘W3TC_DYNAMIC_SECURITY’, ‘mycode’);

    The result is that the Menu is cached and when 2 different users access to the page, the second one sees the first user dynamic information on it, as the menu has been cached.

    Any suggestion? Am I doing something wrong?

    Thank you very much.

    Plugin Contributor gidomanders

    (@gidomanders)

    @iokinpardo Since do_shortcode is a WordPress function, the Late Initialization option is required. If that option is disabled, you might be using Disk: Enhanced, which doesn’t allow Fragment Caching.

    Also, your code is missing the second - for HTML comments and it won’t work if you add the PHP open and close tags (that’ll run the PHP code and cache the output, which defeats the purpose of fragment caching). It should be:

    
    <!–- mfunc mycode -–>
    echo do_shortcode(‘[responsive_menu_pro]’);
    <!–- /mfunc mycode -–>
    

    Hi, I had:

    – WP multi-site
    – W3TC paid version
    – “Late Initialization” enabled
    – “Disk: Basic”
    – “Browser cache” disabled
    – “Minify” disabled
    – “mfunc” added to the ‘Ignored comment stems’

    Inside my theme’s “header.php” file at the end, this code:
    <!–- mfunc FRAGMENT_CACHING -–>
    echo do_shortcode(‘[responsive_menu_pro]’);
    <!–- /mfunc FRAGMENT_CACHING -–>

    Inside the “wp-config.php”:
    define(‘W3TC_DYNAMIC_SECURITY’, ‘FRAGMENT_CACHING’);

    And the Fragment is being cached all the time.

    I have not seen in any site any example of the Fragment cache working.
    Any help would be more than appreciated as I have more that 30 sites waiting for their cache.

    Plugin Contributor gidomanders

    (@gidomanders)

    Since you have the paid version of the plugin, you could ask for help configuring the website by submitting a support request at Performance => Support. That way we can help you better by debugging on your system.

    bgdstr

    (@bogdanstratulat)

    Can we please have an update regarding this issue? Has this been sorted out? Please feel free to close and mark this topic as resolved.

    If you have any questions, please feel free to send them directly to
    our support department so any delay can be avoided.

    Thank you for using W3 Total Cache!

    Kind regards.
    Bogdan S.

    This has been solved. Thank you very much.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Not cache shortcodes on a post’ is closed to new replies.