No problem!
For a quick fix at this point that should work fine, Add the following code to the functions.php in your theme:
IMPORTANT:
– This code will always delete ALL cache for the domains.
– WP Super Cache needs to be active! (tested on latest version: 1.4.x)
– Polylang needs to be active! (tested on latest version: 1.8.x)
add_action( 'wp_trash_post', 'my_theme_clear_all_cache_all_languages', 0);
add_action( 'publish_post', 'my_theme_clear_all_cache_all_languages', 0);
add_action( 'edit_post', 'my_theme_clear_all_cache_all_languages', 0);
add_action( 'delete_post', 'my_theme_clear_all_cache_all_languages', 0);
add_action( 'wp_update_nav_menu', 'my_theme_clear_all_cache_all_languages' );
add_action( 'clean_post_cache', 'my_theme_clear_all_cache_all_languages' );
function my_theme_clear_all_cache_all_languages() {
$blog_id = get_current_blog_id();
if (isset($polylang)) {
$languages = $polylang->get_languages_list();
}
if ( ! empty( $languages ) ) {
foreach ( $languages as $lang ) {
$url = $lang->home_url;
$url = trailingslashit( strtolower( preg_replace( '/:.*$/', '', str_replace( 'https://', '', str_replace( 'https://', '', $url ) ) ) ) );
if ( $this->blog_id == 0 ) {
$defaultUrl = get_option( 'home' );
} else {
$defaultUrl = get_blog_option( $blog_id, 'home' );
}
$defaultUrl = trailingslashit( strtolower( preg_replace( '/:.*$/', '', str_replace( 'https://', '', str_replace( 'https://', '', $defaultUrl ) ) ) ) );
$defaultCacheDir = get_supercache_dir( $blog_id );
$cacheDir = str_replace( $defaultUrl, $url, $defaultCacheDir );
prune_super_cache( $cacheDir, true );
}
}
}