Opened 5 years ago
#48478 new enhancement
Allow omitting meta keys from the REST API response if they do not exist
Reported by: | TimothyBlynJacobs | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Options, Meta APIs | Keywords: | needs-patch |
Focuses: | rest-api | Cc: |
Description
Currently, the REST API will include all show_in_rest
registered meta keys in a response, even if that meta key has no value. When the meta key has no value, either the empty value or a custom default in show_in_rest.schema.default
is used.
If an API client PUTs back this response, the meta key will be created with this default value. This may be undesirable if a user hasn't actually interacted with that meta key.
This could be addressed by allowing the user to specify that the meta key should not be included in the REST API if it does not exist. For instance, show_in_rest.omit_if_not_exists
.
Related Gutenberg ticket: https://github.com/WordPress/gutenberg/issues/17864
Note: See
TracTickets for help on using
tickets.