WordPress.org

Ready to get started?Download WordPress

Forums

Quick Cache (Speed Without Compromise)
[Plugin: Quick Cache ( A WP Super Cache Alternative )] Clear a post's cache when someone commen (4 posts)

  1. arvincastro
    Member
    Posted 3 years ago #

    Is there a way to clear a specific cached post or page when someone posts a comment?

    My blog is not very active so I set the cache expiration to 5 days, but I want that the cache for a post to be refreshed when someone comments, which is also rare.

    http://wordpress.org/extend/plugins/quick-cache/

  2. arvincastro
    Member
    Posted 3 years ago #

    Solve it, hehe. Just added this code to my theme's functions.php file.

    add_filter("comment_post_redirect", "ws_plugin__qcache_clear_on_post_page_comment", 10, 2);
    function ws_plugin__qcache_clear_on_post_page_comment($location, $comment) {
    	ws_plugin__qcache_clear_on_post_page_creations_deletions($comment->comment_post_ID);
    	return $location;
    }

    then edited wp-content/plugins/quick-cache/includes/functions/clearing-routines.inc.php, edited the ws_plugin__qcache_clear_on_post_page_creations_deletions function:

    Changed line 34 to (Quick Cache v2.2.7):

    if (in_array ($pagenow, ($pages = array ("edit.php", "post.php", "post-new.php", "wp-comments-post.php"))))

    *added 'wp-comments-post.php' in the whitelist
    This will clear the cache for this specific post. and, depending on settings, will clear the cache for the home page also.

  3. Pr0t0c0L2010
    Member
    Posted 3 years ago #

    i try this and in my case just dont work. i got lots of errors when i post a news comment.

  4. arvincastro
    Member
    Posted 3 years ago #

    The function to clear the cache was changed in the recent version of the plugin. And I haven't found a solution yet for it.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic