[wp-trac] [WordPress Trac] #36784: wp_update_comment should work with meta
WordPress Trac
noreply at wordpress.org
Sun May 8 14:45:05 UTC 2016
#36784: wp_update_comment should work with meta
-------------------------+-----------------------------
Reporter: dshanske | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 4.4
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
Since 4.4, wp_insert_comment allows you to pass through meta that will be
added to the new comment...
{{{
// If metadata is provided, store it.
if ( isset( $commentdata['comment_meta'] ) && is_array(
$commentdata['comment_meta'] ) ) {
foreach ( $commentdata['comment_meta'] as $meta_key => $meta_value
) {
add_comment_meta( $comment->comment_ID, $meta_key,
$meta_value, true );
}
}
}}}
I have found this very useful in simplifying my new comment construction.
Suggesting the same code be added to wp_update_comment, except using
update_comment_meta, to mirror the functionality.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36784>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list