Make WordPress Core


Ignore:
Timestamp:
06/24/2020 12:03:33 AM (5 years ago)
Author:
whyisjake
Message:

Comments: Allow wp_update_comment() to return WP_Error().

The wp_update_comment_data filter introduced in 4.7 allows comment data to be filtered before it is updated in the database.

The patch aims to handle WP_Error as the filter above return value in a similar manner as is done for wp_new_comment().

Fixes #39732.

Props: enricosorcinelli, swissspidy, gkloveweb, jnylen0, jbpaul17, afercia, SergeyBiryukov, audrasjb, imath, davidbaumwald.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r48104 r48154  
    37893789        }
    37903790
    3791         $result = wp_update_comment( $comment );
    3792         if ( is_wp_error( $result ) ) {
     3791        $result = wp_update_comment( $comment, true );
     3792        if ( is_wp_error( $result ) || false === $result ) {
    37933793            return new IXR_Error( 500, $result->get_error_message() );
    37943794        }
Note: See TracChangeset for help on using the changeset viewer.