Author: Stasyuk Eugene 71 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

How to Translate a WordPress Theme to Another Language перевод

How to Translate a WordPress Theme to Another Language

How to Translate a WordPress Theme to Another Language

While working on creating a WordPress theme, we often come across such inscriptions as “upload more, author, tags”, etc. For example, as in my blog: It’s good when the site is in one language. Then you don’t really need to do anything with them. But what to do when the site is multilingual. If the […]

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 […]