isDir()) { rmdir($file->getRealPath()); } else { unlink($file->getRealPath()); } } rmdir($cache_path); } // Remove advanced-cache.php if it's ours. $advanced_cache = WP_CONTENT_DIR . '/advanced-cache.php'; if (file_exists($advanced_cache)) { $content = file_get_contents($advanced_cache); if (strpos($content, 'WP Recache') !== false) { unlink($advanced_cache); } }