From 455cc051fc8ffd43917f64601f2a0ecd87ee452f Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 26 Jul 2019 13:19:44 +0000 Subject: [PATCH] REST API: Make "Could not update meta value in database" error messages more helpful. Props apermo, AkSDvP. Fixes #46252. git-svn-id: https://develop.svn.wordpress.org/trunk@45681 602fd350-edb4-49c9-b593-d223f7449a82 --- .../rest-api/fields/class-wp-rest-meta-fields.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php b/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php index a24a5f649c..9cfee2ee71 100644 --- a/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php +++ b/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php @@ -267,7 +267,8 @@ abstract class WP_REST_Meta_Fields { if ( ! delete_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash( $value ) ) ) { return new WP_Error( 'rest_meta_database_error', - __( 'Could not update meta value in database.' ), + /* translators: %s: custom field key */ + sprintf( __( 'Could not update the meta value of %s in database.' ), $meta_key ), array( 'key' => $name, 'status' => WP_Http::INTERNAL_SERVER_ERROR, @@ -280,7 +281,8 @@ abstract class WP_REST_Meta_Fields { if ( ! add_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash( $value ) ) ) { return new WP_Error( 'rest_meta_database_error', - __( 'Could not update meta value in database.' ), + /* translators: %s: custom field key */ + sprintf( __( 'Could not update the meta value of %s in database.' ), $meta_key ), array( 'key' => $name, 'status' => WP_Http::INTERNAL_SERVER_ERROR, @@ -330,7 +332,8 @@ abstract class WP_REST_Meta_Fields { if ( ! update_metadata( $meta_type, $object_id, wp_slash( $meta_key ), wp_slash( $value ) ) ) { return new WP_Error( 'rest_meta_database_error', - __( 'Could not update meta value in database.' ), + /* translators: %s: custom field key */ + sprintf( __( 'Could not update the meta value of %s in database.' ), $meta_key ), array( 'key' => $name, 'status' => WP_Http::INTERNAL_SERVER_ERROR,