Make WordPress Core

Opened 8 weeks ago

#64019 new enhancement

Improve clarity of REST API meta field error message "The %s property has an invalid stored value, and cannot be updated to null."

Reported by: takahashi_fumiki's profile Takahashi_Fumiki Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: REST API Keywords:
Focuses: rest-api Cc:

Description

The current error message for invalid meta field values in REST API is unclear and not actionable.
This message could be displayed to end user(e.g. in the block editor)

Current message:

"The %s property has an invalid stored value, and cannot be updated to null."

Related Files:

Issues:

  1. Unclear what "property" refers to (meta field? custom field?)
  2. Doesn't explain what makes the value invalid
  3. No guidance on how to fix the issue

Proposed improvement:

'The field "%s" contains an invalid value, and cannot be updated. Please enter a valid value or contact your site administrator.'

This message is used in 2 different controllers, so it's also possible to make variations for each class:

  • For settings controller: 'The setting "%s" contains an invalid value...'
  • For meta fields: 'The meta field "%s" contains an invalid value...'

Related Issues:

Gutenberg #17864: "Saving a certain meta key saves other unmodified keys" https://github.com/WordPress/gutenberg/issues/17864

This error often appears when Block Editor sends unintended empty values.
It's also possible to change Block Editor's error handling in Gutenberg project.

Change History (0)

Note: See TracTickets for help on using tickets.