• Resolved Demir

    (@sdarthenos)


    Hello,

    We have a site with LightSpeed Cache installed. Our “Purge” settings are like here. According to this, when a new article is published or updated, the cache of all category and tag pages belonging to the article is refreshed.

    We receive a lot of comments on published articles. We use the WPDisquz plugin for comments on our site. The caches of the pages I mentioned above are renewed after each comment and/or liking made to the article.

    Due to the subject of the articles published on our site, an article contains more than one category and tags. Refreshing this many pages each time a comment is made or a comment is liked slows down the displaying of these pages.

    Can you suggest a solution for this?
    Thanks in advance for your interest and help.
    Best regards.

    LiteSpeed Report number: ALONAEEV

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    please try add this into your theme’s functions.php

    add_action("wpdiscuz_after_comment_post", function ($newComment, $currentUser) {
    $post_id = $newComment->comment_post_ID;
    ob_start( function($buffer) use ($post_id) {
        @header("X-LiteSpeed-Purge: " . LSWCP_TAG_PREFIX . "_Po." . $post_id );
        return $buffer;
    } );
    }, 10, 2);

    this should suppress all other purges but only to the post itself

    Best regards,

    Thread Starter Demir

    (@sdarthenos)

    Hi,

    The problem was solved with the code you sent.
    Thank you.

    Best regards.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Refreshing the cache when commenting on an article’ is closed to new replies.