Skip to content

Commit

Permalink
Add roc_manage_redis_capability filter to allow customizing who can f…
Browse files Browse the repository at this point in the history
…lush cache
  • Loading branch information
pmgarman committed Jun 6, 2024
1 parent 6285077 commit e40110e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed `wp_cache_flush_group` issue with Predis and replication connection
- Fixed rare fatal error in `show_error_and_die()` (one more time)
- Add `roc_manage_redis_capability` filter to allow customizing who can flush cache

## 2.5.2

Expand Down
10 changes: 9 additions & 1 deletion includes/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,15 @@ public function obscure_url_secrets( $url ) {
* @return string
*/
public function manage_redis_capability() {
return is_multisite() ? 'manage_network_options' : 'manage_options';
$capability = is_multisite() ? 'manage_network_options' : 'manage_options';

/**
* Filters the capability used to determine if a user can manage Redis.
*
* @since 2.6.0
* @param string $capability The default capability to determine if the user can manage cache.
*/
return apply_filters( 'roc_manage_redis_capability', $capability );
}

/**
Expand Down

0 comments on commit e40110e

Please sign in to comment.