Skip to content

Commit 63c6211

Browse files
committed
fixes
1 parent 27a6dae commit 63c6211

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

features/theme-cache.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ Feature: Manage theme cache
44
Given a WP installation
55

66
Scenario: Clear cache for a single theme
7-
When I run `wp theme install twentytwentyfour --force --activate`
7+
When I run `wp theme install twentytwenty --force --activate`
88
Then STDOUT should contain:
99
"""
1010
Success:
1111
"""
1212

13-
When I run `wp theme cache clear twentytwentyfour`
13+
When I run `wp theme cache clear twentytwenty`
1414
Then STDOUT should be:
1515
"""
16-
Success: Cleared cache for 'twentytwentyfour' theme.
16+
Success: Cleared cache for 'twentytwenty' theme.
1717
"""
1818

1919
Scenario: Clear cache for multiple themes
@@ -23,13 +23,13 @@ Feature: Manage theme cache
2323
Success:
2424
"""
2525

26-
When I run `wp theme install twentytwentyfour --force `
26+
When I run `wp theme install twentytwenty --force `
2727
Then STDOUT should contain:
2828
"""
2929
Success:
3030
"""
3131

32-
When I run `wp theme cache clear twentytwentythree twentytwentyfour`
32+
When I run `wp theme cache clear twentytwentythree twentytwenty`
3333
Then STDOUT should be:
3434
"""
3535
Success: Cleared cache for 2 themes.

src/Theme_Cache_Command.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ public function clear( $args, $assoc_args ) {
9696
* @param array $assoc_args Associative arguments. Unused.
9797
*/
9898
public function flush( $args, $assoc_args ) {
99-
wp_cache_flush_group( 'themes' );
99+
// Only added in WordPress 6.1.
100+
if ( function_exists( 'wp_cache_flush_group' ) ) {
101+
wp_cache_flush_group( 'themes' );
102+
}
100103
WP_CLI::success( 'The theme cache was flushed.' );
101104
}
102105

0 commit comments

Comments
 (0)