• Resolved boghy933

    (@boghy933)


    Hello,

    I have a custom plugin with a settings page, and I want to purge cache on save.

    As you suggest i call the code below on settings save.

    
    if (function_exists('sg_cachepress_purge_cache')) {
        sg_cachepress_purge_cache();
    }
    

    And is working on my homepage; But the translated page (we use WPML for that and the url is website.com/en/ ) did not get purged.

    I’ve event tried to add sg_cachepress_purge_cache(get_home_url('/en/')); but did not worked.

    Do you have any suggestion on how to solve this problem ?
    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey @boghy933

    Would it be possible to provide url to your site, so we can check the issue?

    Regards,
    Stanimir

    Hi Stanimir!
    Thank you for your reply; I am a co-worker of Alex.
    The homepage is https://roma.dalbolognese.it/ while the translated homepage (where the cache-purging does not seem to work) is https://roma.dalbolognese.it/en/.
    Thanks,
    Guido

    Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey

    Sorry for my late response.

    I just checked your site and the function is working.

    Here are the request and the response I get:

    PURGE /en(.*) HTTP/1.0
    Host: roma.dalbolognese.it
    Connection: Close
    

    HTTP/1.1 200 OK

    I’ve used the following:
    sg_cachepress_purge_cache(get_home_url('/en/'));

    Would it be possible to check again if everything works?

    Regards,
    Stanimir

    Thread Starter boghy933

    (@boghy933)

    Hello @sstoqnov, thank you for your time,

    The only way i get the cache clean for my purpose over the page /en/ is by pushing the purge button in the top bar.

    Maybe i am watching the problem in the wrong way, i will try to give more details about my implementation.

    We are using this gravity forms add-on https://gravitywiz.com/documentation/gravity-forms-limit-dates/ to limit dates over the gravity form module.
    The settings of the plugin are added as javascript over the page.

    
    <script type='text/javascript'>
    /* <![CDATA[ */
    var GPLimitDatesData = {"serverTimezoneOffset":"120","strings":{"invalidDate":"Invalid Date"}};
    var GPLimitDatesData5 = {"6":{"minDate":"{today}","minDateMod":"","minDateExcludeBeforeToday":"","minDateExcludeBeforeTodayMod":"","maxDate":"{today}","maxDateMod":"+30 days","daysOfWeek":[2,3,4,5,6,0],"exceptions":["12\/25\/2018","01\/01\/2019","04\/21\/2019","04\/23\/2019"],"dateFormat":"dmy","disableAll":false,"inlineDatepicker":false}};
    /* ]]> */
    </script>
    

    We created a settings page that hooks in the plugin and adds a date in the exceptions parameter of the javascript settings (using a filter).

    During the settings save process i run sg_cachepress_purge_cache and see the correct results in the homepage, but in the /en/ homepage i still see the old data until i press the purge cache button.

    Maybe i should clear another type of cache ?

    Please feel free to let me know if you need further informations.
    Thank you,
    Alex.

    Thread Starter boghy933

    (@boghy933)

    Hello @sstoqnov

    Any update?

    Thank you
    Alex.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Purge Cache’ is closed to new replies.