WordPress.org

Make WordPress Core

Changeset 48216


Ignore:
Timestamp:
06/29/2020 11:04:17 PM (6 days ago)
Author:
SergeyBiryukov
Message:

Comments: Make wp_update_comment() return a WP_Error object on database error, if $wp_error parameter is true.

Follow-up to [48154], [48215].

See #39732.

File:
1 edited

Legend:

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

    r48215 r48216  
    25142514    $rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
    25152515
     2516    if ( false === $rval ) {
     2517        if ( $wp_error ) {
     2518            return new WP_Error( 'db_update_error', __( 'Could not update comment in the database.' ), $wpdb->last_error );
     2519        } else {
     2520            return false;
     2521        }
     2522    }
     2523
    25162524    // If metadata is provided, store it.
    25172525    if ( isset( $commentarr['comment_meta'] ) && is_array( $commentarr['comment_meta'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.