WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/24/2020 12:03:33 AM (7 months 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-admin/includes/ajax-actions.php

    r48115 r48154  
    14111411        $_POST['comment_status'] = $_POST['status'];
    14121412    }
    1413     edit_comment();
     1413
     1414    $updated = edit_comment();
     1415    if ( is_wp_error( $updated ) ) {
     1416        wp_die( $updated->get_error_message() );
     1417    }
    14141418
    14151419    $position      = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
Note: See TracChangeset for help on using the changeset viewer.