Make WordPress Core


Ignore:
Timestamp:
06/29/2020 11:40:56 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Comments: Make wp_update_comment() return a WP_Error object for a canceled update, if $wp_error parameter is true.

Remove redundant checks for wp_update_comment() results being false, as the function always returns a WP_Error object now if $wp_error is true.

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

See #39732.

File:
1 edited

Legend:

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

    r48216 r48218  
    25042504        $data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr, $wp_error );
    25052505
     2506        if ( ! $data ) {
     2507                $data = new WP_Error( 'comment_update_canceled', __( 'Comment update canceled.' ) );
     2508        }
     2509
    25062510        // Do not carry on on failure.
    2507         if ( is_wp_error( $data ) || ! $data ) {
    2508                 return $data;
     2511        if ( is_wp_error( $data ) ) {
     2512                if ( $wp_error ) {
     2513                        return $data;
     2514                } else {
     2515                        return false;
     2516                }
    25092517        }
    25102518
Note: See TracChangeset for help on using the changeset viewer.