Author: Stasyuk Eugene 44 15.03.2024

Cloudabove has the ability to speed up a site by caching on the server. By default, this cache is cleared every 15 minutes. This speeds up the site quite a bit, but it also affects the display of content. For example, in my case, a product review posted by a user did not appear until 15 minutes later.

Clearing the cache is pretty simple. It is based on a GET request to https://scout.cloudabove.com/api/cache/purge. It is important that the request comes from your server, otherwise the API will not accept the request.

In the case of Woocommerce reviews, we will use the comment_post hook and the wp_remote_get() function

function clear_server_cache($comment_id, $comment_approved) {

    if($comment_approved == 1){
        wp_remote_get('https://scout.cloudabove.com/api/cache/purge', array('timeout' => 5));
    }
}

add_action( 'comment_post', 'clear_server_cache', 20, 2 );

In addition, we can clear the cache from the site’s admin area using the button

To make it available, you need to place this file scout-cache-helper.php in the wp-content/mu-plugins folder of our website.

Other articles

Simple star rating stars

Simple star rating

Simple star rating

In this article, I will show you how to make the visual part of the star rating. Namely: Finished option: Markup As a markup, we have a container block with the .rate class inside which I have placed 5 links. I used a font as a star. But most likely in practice you will have […]

FAQ question

FAQ

FAQ

How to remove the prefix “Category, Label …” from archive pages? Place the filter in the functions.php file in our theme folder How to remove the scale of images when uploading to media? Place the filter in the functions.php file in our theme folder How to style scrollbar (css)? Why doesn’t search work on a […]