WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
[resolved] trouble with dynamic content (4 posts)

  1. Nic Windley
    Member
    Posted 1 year ago #

    I've read through the dynamic content section and setup WP Super Cache in both PHP and Legacy modes with Late Init enabled and no matter what I do I don't seem able to keep a section of code dynamic.

    I'm trying to pass a session variable that works fine without cache enabled.

    I've tried raw code wrapped in the tags as defined in the FAQ;

    <!--mfunc
    get_form_popup();
    global $wp_query;
    $_SESSION['popupwpparentpage'] = $wp_query->post->post_parent;
    $_SESSION['popupwppageID'] = $wp_query->post->ID;
    -->
    <?php get_form_popup();
    global $wp_query;
    $_SESSION['popupwpparentpage'] = $wp_query->post->post_parent;
    $_SESSION['popupwppageID'] = $wp_query->post->ID; ?>
    <!--/mfunc-->

    I've also created a function and used the other tag;

    <!--dynamic-cached-content--><?php
    get_form_popup();
    ?>
    <!--
    <?php
    get_form_popup();
    ?>
    -->
    <!--/dynamic-cached-content-->

    The session variable remain unset with WP Super Cache ? Can anybody see what I'm doing wrong ?

    Thanks,

    Nic

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. Nic Windley
    Member
    Posted 1 year ago #

    I have noticed this in the FAQ after the dynamic content section;

    How do I delay serving the cache until the "init" action fires?

    Cached files are served before almost all of WordPress is loaded. While that's great for performance it's a pain when you want to extend the plugin using a core part of WordPress. Set $wp_super_cache_late_init to "1" in wp-content/wp-cache-config.php and cached files will be served when "init" fires. WordPress and it's plugins will be loaded now. This is very useful when you are using the mfunc tag in your theme.

    As these tags are being included into a theme do I need to follow this step ?

    If so, when creating this file wp-cache-config.php do I need to mirror all settings in WP Super Cache (saved in DB) ?

  3. Nic Windley
    Member
    Posted 1 year ago #

    Hmm, okay, so I took a look at the cached file and this is what I see. Mostly HTML, apart from where I want the PHP which looks good. For some reason there is a double semi colon however this should still work.

    <!--mfunc-->
    <?php global $wp_query;
    $_SESSION['popupwpparentpage'] = $wp_query->post->post_parent;
    $_SESSION['popupwppageID'] = $wp_query->post->ID; ;?>
    <!--/mfunc-->

    I'll check the session variable being generated.

  4. Nic Windley
    Member
    Posted 1 year ago #

    OK, this is actually working fine. The session variables are live so its a problem with the code that should be picking them up.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic