mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@48216 git-svn-id: http://core.svn.wordpress.org/trunk@47985 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d8a08ecada
commit
e2936bd7e5
@ -2513,6 +2513,14 @@ function wp_update_comment( $commentarr, $wp_error = false ) {
|
||||
|
||||
$rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
|
||||
|
||||
if ( false === $rval ) {
|
||||
if ( $wp_error ) {
|
||||
return new WP_Error( 'db_update_error', __( 'Could not update comment in the database.' ), $wpdb->last_error );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// If metadata is provided, store it.
|
||||
if ( isset( $commentarr['comment_meta'] ) && is_array( $commentarr['comment_meta'] ) ) {
|
||||
foreach ( $commentarr['comment_meta'] as $meta_key => $meta_value ) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48215';
|
||||
$wp_version = '5.5-alpha-48216';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user