REST API: Make "Could not update meta value in database" error messages more helpful.

Props apermo, AkSDvP.
Fixes #46252.
Built from https://develop.svn.wordpress.org/trunk@45681


git-svn-id: http://core.svn.wordpress.org/trunk@45492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-07-26 13:20:56 +00:00
parent e925997562
commit 33b2fbc7e7
2 changed files with 7 additions and 4 deletions

View File

@ -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,

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-alpha-45680';
$wp_version = '5.3-alpha-45681';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.