Last active
May 23, 2023 14:39
-
-
Save mustafauysal/c81e0141bd03120b71b37dfca40651b1 to your computer and use it in GitHub Desktop.
Remove phastpress cache when purging cache on Powered Cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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