Make WordPress Core

Ticket #40669: 40669-comments.diff

File 40669-comments.diff, 1.5 KB (added by spacedmonkey, 9 years ago)
  • src/wp-includes/comment.php

     
    423423 * @return int|bool Meta ID on success, false on failure.
    424424 */
    425425function add_comment_meta($comment_id, $meta_key, $meta_value, $unique = false) {
    426         return add_metadata('comment', $comment_id, $meta_key, $meta_value, $unique);
     426        $added = add_metadata( 'comment', $comment_id, $meta_key, $meta_value, $unique );
     427        if ( $added ) {
     428                wp_cache_set( 'last_changed', microtime(), 'comments' );
     429        }
     430
     431        return $added;
    427432}
    428433
    429434/**
     
    442447 * @return bool True on success, false on failure.
    443448 */
    444449function delete_comment_meta($comment_id, $meta_key, $meta_value = '') {
    445         return delete_metadata('comment', $comment_id, $meta_key, $meta_value);
     450        $deleted = delete_metadata( 'comment', $comment_id, $meta_key, $meta_value );
     451        if ( $deleted ) {
     452                wp_cache_set( 'last_changed', microtime(), 'comments' );
     453        }
     454
     455        return $deleted;
    446456}
    447457
    448458/**
     
    479489 * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
    480490 */
    481491function update_comment_meta($comment_id, $meta_key, $meta_value, $prev_value = '') {
    482         return update_metadata('comment', $comment_id, $meta_key, $meta_value, $prev_value);
     492        $updated = update_metadata( 'comment', $comment_id, $meta_key, $meta_value, $prev_value );
     493        if ( $updated ) {
     494                wp_cache_set( 'last_changed', microtime(), 'comments' );
     495        }
     496
     497        return $updated;
    483498}
    484499
    485500/**