Skip to content

Instantly share code, notes, and snippets.

@mustafauysal
Last active May 23, 2023 14:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mustafauysal/c81e0141bd03120b71b37dfca40651b1 to your computer and use it in GitHub Desktop.
Save mustafauysal/c81e0141bd03120b71b37dfca40651b1 to your computer and use it in GitHub Desktop.
Remove phastpress cache when purging cache on Powered Cache
<?php
add_action( 'plugins_loaded', function () {
add_action( 'powered_cache_flushed', 'flush_phast_cache' );
add_action( 'powered_cache_purge_all_cache', 'flush_phast_cache' );
add_action( 'powered_cache_clean_site_cache_dir', 'flush_phast_cache' );
} );
function flush_phast_cache() {
$cache_dir = WP_CONTENT_DIR . '/cache/';
$db_files = glob( $cache_dir . 'phast.*/*sqlite3*' );
foreach ( $db_files as $file ) {
@unlink( $file );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment