Ticket #12431: 12431.diff
| File 12431.diff, 1.3 KB (added by , 10 years ago) |
|---|
-
src/wp-includes/comment-functions.php
1419 1419 } 1420 1420 $comment = get_comment( $id ); 1421 1421 1422 // If metadata is provided metadata, store it now that we know the comment ID 1423 if ( isset( $commentdata['comment_meta'] ) && is_array( $commentdata['comment_meta'] ) ) { 1424 foreach ( $commentdata['comment_meta'] as $meta_key => $meta_value ) { 1425 add_comment_meta( $comment->comment_ID, $meta_key, $meta_value, true ); 1426 } 1427 } 1428 1422 1429 /** 1423 1430 * Fires immediately after a comment is inserted into the database. 1424 1431 * -
tests/phpunit/tests/comment.php
273 273 $sent = wp_new_comment_notify_postauthor( $c ); 274 274 $this->assertFalse( $sent ); 275 275 } 276 277 /** 278 * @ticket 12431 279 */ 280 public function test_wp_new_comment_with_meta() { 281 $c = $this->factory->comment->create( array( 282 'comment_approved' => '1', 283 'comment_meta' => array( 284 'food' => 'taco', 285 'sauce' => 'fire' 286 ) 287 ) ); 288 289 $this->assertEquals( 'fire', get_comment_meta( $c, 'sauce', true ) ); 290 } 276 291 }