Comments: Introduce the wp_update_comment_data
filter.
Filters the comment data immediately before it is updated in the database. Props frankiet, dshanske, DrewAPicture. Fixes #36302. git-svn-id: https://develop.svn.wordpress.org/trunk@38674 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0d0e2bf2ba
commit
93553e5e10
@ -2027,6 +2027,20 @@ function wp_update_comment($commentarr) {
|
||||
$comment_post_ID = $data['comment_post_ID'];
|
||||
$keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP' );
|
||||
$data = wp_array_slice_assoc( $data, $keys );
|
||||
|
||||
/**
|
||||
* Filters the comment data immediately before it is updated in the database.
|
||||
*
|
||||
* Note: data being passed to the filter is already unslashed.
|
||||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param array $data The new, processed comment data.
|
||||
* @param array $comment The old, unslashed comment data.
|
||||
* @param array $commentarr The new, raw comment data.
|
||||
*/
|
||||
$data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr );
|
||||
|
||||
$rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
|
||||
|
||||
clean_comment_cache( $comment_ID );
|
||||
|
Loading…
Reference in New Issue
Block a user