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
This commit is contained in:
Sergey Biryukov 2019-07-26 13:19:44 +00:00
parent 230960f8c0
commit 455cc051fc

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,