• bward

    (@bward)


    With we are running the Cloudflare plugin with APO. We are also using the WP Discourse plugin for blog comments. However, once a comment is added to a post, APO does not recognize a comment was added so the cache for that post is not purged. That means the comment count on the WordPress post never updates.

    We had a similar issue with WP Rocket not purging the cache when a new comment was added to the forum. I worked with those guys and they provided the following code which works.

    if( function_exists( 'rocket_clean_post' ) ){
    	add_action( 'wpdc_after_webhook_post_update', 'bulk_rocket_clean_post’);
    }
    
    function bulk_rocket_clean_post(array $ids){
        foreach ($ids as $id) {
            rocket_clean_post($id);
        }
    }

    The wpdc_after_webhook_post_update action was provided by the WP Discourse team. The rest of the code came from the WP Rocket team to fire the action.

    My question, what code can we add to our site so when someone leaves a comment on the forum, it registers with the Cloudflare plugin so the APO cache for that post is purged and the comment count is updated on the WordPress post?

    Thank you!!

    • This topic was modified 2 years ago by bward.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Did you found a solution @bward ?

    Thread Starter bward

    (@bward)

    No sir.

    I’ve opened tickets with Cloudflare and on their forums as well with no answer.

    You will need to purge it via API call, programmatically.
    However, for APO specifically, you need to purge everything.

    If you purge a specific URL, it doesn’t clear the same url with query strings.
    If you have separate cache for mobile active, it only purges the desktop version.

    If you are enterprise though, you can do wildcard queries to purge the url, but still no luck with mobile/desktop clearing by purging only the url.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to purge cache w/APO when using WP Discourse?’ is closed to new replies.