From 3e42184d6b5e6e521c2f343426242e04735347e8 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 26 Aug 2026 06:21:40 +0000 Subject: [PATCH] Check for wp_cache_flush_group() before calling it `wp cache flush-group` asked `wp_cache_supports( 'flush_group' )` whether group flushing was available, then called `wp_cache_flush_group()`. Both arrived in WordPress 6.1, so the version question was covered, but the guard tested a different function than the one being called: `wp_cache_supports()` is answered by the object cache drop-in, and a drop-in that reports support without defining `wp_cache_flush_group()` would have caused a fatal rather than the intended error message. Check for the function itself as well. That is also the guard johnbillion/wp-compat understands, so the single error it reported for this package is resolved without needing an ignore entry. Co-authored-by: Pascal Birchler --- src/Cache_Command.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Cache_Command.php b/src/Cache_Command.php index ab5c8b56..caa9ba23 100644 --- a/src/Cache_Command.php +++ b/src/Cache_Command.php @@ -425,7 +425,7 @@ public function supports( $args ) { public function flush_group( $args ) { list( $group ) = $args; - if ( ! function_exists( 'wp_cache_supports' ) || ! wp_cache_supports( 'flush_group' ) ) { + if ( ! function_exists( 'wp_cache_supports' ) || ! function_exists( 'wp_cache_flush_group' ) || ! wp_cache_supports( 'flush_group' ) ) { WP_CLI::error( 'Group flushing is not supported.' ); }