WordPress.org

Forums

Quick Cache (Speed Without Compromise)
[resolved] How to get it work with WP-Polls plugin? (5 posts)

  1. jackennils
    Member
    Posted 1 year ago #

    Hello,

    I really would like to give your plugin a try, but unfortunately it's not working with WP-Polls plugin. If someone visits a site with Quick Cache enabled, he will see the unanswered poll. After answering the poll, the user still sees it as unanswered instead of the result.

    Any idea how to fix that?

    Thanks
    Nils

    https://wordpress.org/plugins/quick-cache/

  2. raamdev
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Nils,

    It sounds like WP-Polls doesn't use Javascript to update the poll data on the page. That would allow it to work with page-caching plugins like Quick Cache.

    The only options available at this time would be to setup a custom routine that manually clears the cache when the poll changes, or to exclude the page where the poll is located from the cache altogether.

  3. jackennils
    Member
    Posted 1 year ago #

    Hi Raam,

    Sorry for my late reply and thanks for your help.

    I really would like to use both, your plugin and WP-Polls, I even purchased Quick Cache Pro just a few minutes ago.

    Could you help me with setting up such a routine?

    Thanks and best regards
    Nils

  4. raamdev
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Nils,

    I downloaded WP-Polls and took a look at the code, but unfortunately the WP-Polls code does not provide any action hooks that we can utilize to trigger Quick Cache and get it to purge the cache for the page where the poll is located.

    I've submitted a Pull Request to the WP-Polls developer that includes the changes necessary to make this possible: https://github.com/lesterchan/wp-polls/pull/22

    If/when when WP-Polls developer accepts my Pull Request and releases a new version of WP-Polls that includes my action hooks, you should be able to add the following code to your theme's functions.php file or to an MU-Plugin:

    add_action( 'wp_polls_vote_poll', 'clear_cache_after_poll_vote', 10, 1 );
    
    function clear_cache_after_poll_vote( ) {
        global $post;
        $GLOBALS['quick_cache']->auto_purge_post_cache($post->ID);
    }

    While I was writing this, the WP-Polls developer accepted my Pull Request, so it should just be a matter of time before a new release comes out that includes the necessary changes. :)

  5. jackennils
    Member
    Posted 1 year ago #

    That's very good news, thanks for your help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Quick Cache (Speed Without Compromise)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.