_clear_modified_cache_on_transition_comment_status
Clear 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 (2)
- 0. $new_status (string)
- The new comment status.
- 1. $old_status (string)
- The old comment status.
Usage
if ( !function_exists( '_clear_modified_cache_on_transition_comment_status' ) ) { require_once ABSPATH . WPINC . '/comment.php'; } // The new comment status. $new_status = ''; // The old comment status. $old_status = ''; // NOTICE! Understand what this does before running. $result = _clear_modified_cache_on_transition_comment_status($new_status, $old_status);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/comment.php
- function _clear_modified_cache_on_transition_comment_status( $new_status, $old_status ) {
- if ( 'approved' === $new_status || 'approved' === $old_status ) {
- foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
- wp_cache_delete( "lastcommentmodified:$timezone", 'timeinfo' );
- }
- }
- }