WordPress.org

Make WordPress Core

Ticket #4387: comment.04.patch

File comment.04.patch, 857 bytes (added by hovenko, 8 years ago)

The action wp_set_comment_status will now only be called on when the status has changed

  • crypto/home/hovenko/workspace/NRK

     
    480480        $rval = $wpdb->rows_affected; 
    481481        unset($comment_cache[$comment_ID]); 
    482482        wp_update_comment_count($comment_post_ID); 
    483         do_action('wp_set_comment_status', $comment_ID, wp_get_comment_status($comment_ID)); 
     483        // Only call for wp_set_comment_status if the status has changed 
     484        if ( $comment['comment_approved'] != $commentarr['comment_approved'] ) { 
     485                do_action('wp_set_comment_status', $comment_ID, $commentarr['comment_approved']); 
     486        } 
    484487        do_action('edit_comment', $comment_ID); 
    485488        return $rval; 
    486489}