Clears the lastcommentmodified cached value when a comment status is changed.
Description
Deletes the lastcommentmodified cache key when a comment enters or leaves ‘approved’ status.
Parameters
$new_status
stringrequired- The new comment status.
$old_status
stringrequired- The old comment status.
Source
function _clear_modified_cache_on_transition_comment_status( $new_status, $old_status ) {
if ( 'approved' === $new_status || 'approved' === $old_status ) {
$data = array();
foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
$data[] = "lastcommentmodified:$timezone";
}
wp_cache_delete_multiple( $data, 'timeinfo' );
}
}
Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.