Opened 6 years ago
Last modified 6 years ago
#45417 new enhancement
Lack of actions when wp_cache_flush is called
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | trivial | Version: | |
Component: | Cache API | Keywords: | needs-patch 2nd-opinion |
Focuses: | Cc: |
Description
The function definition of wp_cache_flush doesn't have a do_action call, and neither does WP_Object_Cache->flush.
https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-includes/cache.php#L97
https://core.trac.wordpress.org/browser/tags/4.9.8/src/wp-includes/cache.php#L498
I want to be able to run additional code whenever the object cache is flushed but currently I can't.
Fixing this should be as trivial as adding
do_action('wp_cache_flush');
to the function definition of wp_cache_flush.
I don't care about the name of the action or if it runs before or after the flush, I'd just like to have this functionality in the core. Preferably before WordPress 6.0.
Change History (1)
Note: See
TracTickets for help on using
tickets.
A challenge with this is that if an object-cache dropin is used, then the core
wp-includes/cache.php
file won't be loaded. Any hooks we decide to add would thus become impossible to rely upon.