mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Allow metadata to be updated via wp_update_comment().
Passing an array of `comment_meta` into `wp_update_comment()` will now update corresponding metadata. Similar functionality already exists in `wp_insert_comment()`. Props dshanske, kraftbj. Fixes #36784. git-svn-id: https://develop.svn.wordpress.org/trunk@40981 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -52,6 +52,21 @@ class Tests_Comment extends WP_UnitTestCase {
|
||||
$this->assertEquals( 'pingback', $comment->comment_type );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 36784
|
||||
*/
|
||||
function test_wp_update_comment_updates_comment_meta() {
|
||||
$comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) );
|
||||
wp_update_comment( array(
|
||||
'comment_ID' => $comment_id,
|
||||
'comment_meta' => array(
|
||||
'food' => 'taco',
|
||||
'sauce' => 'fire',
|
||||
),
|
||||
) );
|
||||
$this->assertEquals( 'fire', get_comment_meta( $comment_id, 'sauce', true ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 30307
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user