Make WordPress Core

Changeset 38674


Ignore:
Timestamp:
09/29/2016 01:46:07 PM (8 years ago)
Author:
rachelbaker
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r38650 r38674  
    20282028    $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' );
    20292029    $data = wp_array_slice_assoc( $data, $keys );
     2030
     2031    /**
     2032     * Filters the comment data immediately before it is updated in the database.
     2033     *
     2034     * Note: data being passed to the filter is already unslashed.
     2035     *
     2036     * @since 4.7.0
     2037     *
     2038     * @param array $data       The new, processed comment data.
     2039     * @param array $comment    The old, unslashed comment data.
     2040     * @param array $commentarr The new, raw comment data.
     2041     */
     2042    $data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr );
     2043
    20302044    $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
    20312045
Note: See TracChangeset for help on using the changeset viewer.