WordPress.org

Make WordPress Core

Ticket #12431: preprocess-comment-meta-r13514.patch

File preprocess-comment-meta-r13514.patch, 695 bytes (added by tellyworth, 4 years ago)
  • comment.php

     
    12651265        $commentdata['comment_approved'] = wp_allow_comment($commentdata); 
    12661266 
    12671267        $comment_ID = wp_insert_comment($commentdata); 
     1268         
     1269        // If a filter provided metadata, store it now that we know the comment ID 
     1270        if ( isset( $commentdata['comment_meta'] ) && is_array( $commentdata['comment_meta'] ) ) { 
     1271                foreach ( $commentdata['comment_meta'] as $meta_key => $meta_value ) { 
     1272                        add_comment_meta($comment_ID, $meta_key, $meta_value, true); 
     1273                } 
     1274        } 
    12681275 
    12691276        do_action('comment_post', $comment_ID, $commentdata['comment_approved']); 
    12701277